Alzabo::Index(3pm)

πŸ“¦
version 0.92 Β· 2 versions
  • 0.92 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.92 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Alzabo::Index β€” bestie edition πŸ’–

okay so real quick, this is the manual page for Alzabo::Index(3pm), part of the User Contributed Perl Documentation situation. it's giving "index objects" and honestly? iconic. let's get into it πŸ¦‹


✨ NAME ✨

Alzabo::Index β€” it's literally the Index objects, that's the whole vibe πŸ’…


🌸 SYNOPSIS 🌸

here's the lil snippet, no cap, copy it exactly bestie:

foreach my $i ($table->indexes)
{
   foreach my $c ($i->columns)
   {
      print $c->name;
      print '(' . $i->prefix($c) . ')' if $i->prefix($c);
   }
}

πŸŽ€ DESCRIPTION πŸŽ€

so this object represents an index on a table. that's the main character energy right there ✨

an index is made of columns plus optional prefixes for each column. and what's a prefix? okay so it says how many characters of the column should actually be indexed β€” like, the first X chars. that's it, that's the prefix πŸ“

lowkey important caveats tho, listen up:

  • some RDBMS's don't even have a concept of index prefixes πŸ’€
  • not all column types are likely to allow prefixes β€” but tbh this depends on the RDBMS, so it varies πŸ™ˆ
  • and the order of the columns is significant β€” do not come for the ordering, it matters fr fr

πŸ‘‘ METHODS πŸ‘‘

🧚 columns

returns an ordered list of the Alzabo::Column objects that are being indexed. ordered, bestie. the sequence is the whole point 🌈

πŸ’… prefix (Alzabo::Column object)

okay so a column prefix is β€” and this is quoting the source vibes, "to the best of my knowledge" β€” a MySQL specific concept. which means you cannot set it when you're using an RDBMSRules module for a different RDBMS. periodt.

BUT. it's important enough for MySQL that the functionality is present anyway, so here we are 🫢

what does it do? it lets you specify that the index should only look at a certain portion of a field β€” specifically the first N characters. and heads up: this prefix is required to index any sort of BLOB column in MySQL. required. not optional. don't forget it 😭

this method returns the prefix for the column in the index. if there's no prefix for that column in the index, it returns undef. that's it πŸ’œ

⭐ unique

returns a boolean value telling you whether the index is a unique index. yes or no, slay or not slay ✨

🌸 fulltext

returns a boolean value telling you whether the index is a fulltext index. also boolean. also vibes πŸ’–

πŸ¦‹ function

for function indexes, this returns the function being indexed. that's the whole thing πŸŽ€

πŸ”₯ id

the id is generated from the table, column and prefix information for the index. which is genuinely useful β€” think canonical name for a hash key, for example. iykyk πŸ’…

returns a string that is the id which uniquely identifies the index in this schema. one id, one index, no duplicates, iconic πŸ‘‘

🌈 table

returns the Alzabo::Table object to which the index belongs. its home. its origin story. its table 🫢


πŸ’œ AUTHOR πŸ’œ

Dave Rolsky, <autarch@urth.org> β€” shoutout to the author, we stan πŸ’–


and that's the page bestie! this was Alzabo::Index(3pm) as shipped with perl v5.34.0, dated 2022-06-14 🌸 go forth and index responsibly, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from