Tangram::Type(3pm)
π NAME π
Tangram::Type β mapping individual fields, bestie. Like, one field at a time, very demure, very mindful. π
β¨ DESCRIPTION β¨
okay so listen. Tangram's persistent type system is extensible, which means you can literally mount your own types and make them persistent. that's the whole vibe. all you gotta do is register your type and provide mapping code, and boom, you're iconic. want the deets? go read Tangram::Type::Extending. π¦
Tangram ships with built-in support for these types, no cap:
πΈ Simple Scalar types
Supported are strings, integers, real numbers and dates. and adding more types of this ilk? literally so easy bestie, obsessed.
"string","int","real"β seeTangram::Type::Scalar"date","time","datetime","dmdatetime"β see"Date/Type/Date/DateTime"inTangram::Type
π Compound Structure types
"perl_dump"β seeTangram::Type::Dump::Perl. a"perl_dump"structure may contain any structure whichData::Dumpercan dump successfully. anything. it ate. π"storable"β seeTangram::Type::Dump::Storable. very much like"perl_dump", but implemented via theStorableserialisation engine. same energy, different engine fr fr."yaml"β seeTangram::Type::Dump::YAML. very much like"perl_dump", but implemented via theYAMLserialisation engine. doesn't currently work, due to inadequacies in the current Perl YAML implementation. π yeah. it's not giving what it's supposed to give.- NEW in Tangram 2.08:
"idbif"β seeTangram::Type::Dump::Any. like the above, but can combine multiple object properties into a single database column. main character move honestly. π
π `Flat' Array & Hash types
note bestie: these are only actually required if you need to be able to query on individual fields inside the array/hash. otherwise? the"perl_dump"or"idbif"mapping is a lot faster and more flexible. so like, choose wisely. π
"flat_array"β see"Array/Scalar"inTangram::Type"flat_hash"β see"Hash/Scalar"inTangram::Type
π¦ References to other objects
"ref"β seeTangram::Type::Ref::FromMany(implementing an N to 1 relationship, in which any object can be the referant)
π Sets of other objects
Set relationships are the closest thing to the main type of relationship used in an RDBMS. Avid CompSci students will know that the relational database model is based heavily on Set Theory, which is a subset of a more general concept of Categories β generic couplings of a number of classes. slay, academia. πβ¨
In Perl space, these collections are represented via the Set::Object module. and heads up: sets may not have duplicate elements, and cannot contain undef values. periodt.
"set"β seeTangram::Type::Set::FromMany(implementing an unordered N to N relationship, with all objects sharing a common base class)"iset"β seeTangram::Type::Set::FromOne(implementing an unordered 1 to N relationship, with all objects sharing a common base class)
π Arrays of other objects
in addition to Sets, you can have Arrays of objects, represented by a standard Perl array in memory. Arrays may contain undef values (in the middle of the list), and the "array" type may contain duplicates (ie, the same element present in separate places in the list). messy? a little. valid? absolutely. π«Ά
"array"β seeTangram::Type::Array::FromMany(implementing an ordered N to N relationship, with all objects sharing a common base class)"iarray"β seeTangram::Type::Array::FromOne(implementing an ordered 1 to N relationship, with all objects sharing a common base class)
π Hashes of other objects
much like the Array types, the Hash types are indexed via a string value, and represented as a Perl hash in memory. and no, these hashes may not contain undef values β those are simply dropped. the "hash" type however may contain duplicate elements. ok werk. π
"hash"β seeTangram::Type::Hash::FromMany(implementing a keyed N to N relationship, with all objects sharing a common base class)"ihash"β seeTangram::Type::Hash::FromOne(implementing a keyed 1 to N relationship, with all objects sharing a common base class)
and that's the whole page bestie!! πβ¨ this lil writeup is living in perl v5.36.0, last touched 2022-10-16, and it's filed under Tangram::Type(3pm). go forth and map those fields, you absolute icon. ππ¦πΈ
π¦ where this page comes from
- ubuntu noble: libtangram-perl 2.12-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtangram-perl 2.12-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtangram-perl 2.12-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms