DBIx::...mn::FS(3pm)

πŸ“¦
version 0.01007 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

🌸 DBIx::Class::InflateColumn::FS πŸ’…

okay bestie, welcome to the User Contributed Perl Documentation for DBIx::...mn::FS β€” which is the manual page name, but the module itself is DBIx::Class::InflateColumn::FS, and yes the header is abbreviated like that, it's giving mystery, it's giving ellipsis-core 🫢


✨ NAME ✨

DBIx::Class::InflateColumn::FS β€” it inflates/deflates your columns into Path::Class::File objects. files as columns, no cap πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe, copy it exactly bestie:

__PACKAGE__->load_components(qw/InflateColumn::FS Core/);
__PACKAGE__->add_columns(
    id => {
        data_type         => 'INT',
        is_auto_increment => 1,
    },
    file => {
        data_type => 'TEXT',
        is_fs_column => 1,
        fs_column_path => '/var/lib/myapp/myfiles',
    },
    file_2 => {
        data_type => 'TEXT',
        is_fs_column => 1,
        fs_column_path => '/var/lib/myapp/myfiles',
        fs_new_on_update => 1
    },
);
__PACKAGE__->set_primary_key('id');

# in application code
$rs->create({ file => $file_handle });

$row = $rs->find({ id => $id });
my $fh = $row->file->open('r');

🌈 DESCRIPTION 🌈

so basically ✨ it provides inflation to a Path::Class::File object, which is the fancy way of saying: you can store BLOBS on the file system and your DB column just pretends. main character energy fr fr πŸ’…

the storage path gets specified with fs_column_path. every single file gets a unique name, so the storage for all FS columns can totally share the same path β€” no fighting, no drama, we love a collaborative queen πŸ‘‘

within the path specified by fs_column_path, files are stored in sub-directories based on the first 2 characters of the unique file names. up to 256 sub-directories will be created, as needed. and if you wanna switch it up, override _fs_column_dirs in a derived class to change this behavior 🧚

and fs_new_on_update will create a new file name if the file has been updated. iconic. obsessed. ⭐


πŸ’– METHODS πŸ’–

inflate_result

register_column

ngl bestie, the docs just list these two by name and say nothing else about them. that's it. that's the entry. i'm not gonna make stuff up, periodt πŸ™ˆ

fs_file_name

this one provides the file naming algorithm. override this method to change it πŸŽ€

it gets called with two parameters: the name of the column, and the column_info object.

_fs_column_dirs

returns the sub-directory components for a given file name. override it if you want to provide a deeper directory tree or just change the algorithm entirely β€” your tree, your rules 🌸

copy

copies a row object, duplicating the files backing fs columns. a full duplicate, files included, no crumbs left behind 🫢

delete

deletes the associated file system storage when a row is deleted. bye bestie, the file's coming with you πŸ’€

set_column

deletes file storage when an fs_column is set to undef. setting it to nothing = poof, gone ✨

set_inflated_column

re-inflates after setting an fs_column. it goes back in, it comes back out πŸ¦‹

_inflate_fs_column

inflates a file column to a Path::Class::File object.

_deflate_fs_column

deflates a file column to its storage path name, relative to fs_column_path.

and here's the important bit bestie: in the database, a file column is just a place holder for inflation/deflation. the actual file lives in the file system. the column is the vibe, the file is the reality πŸ‘‘

table

overridden to provide a hook for specifying the resultset_class. and listen β€” if you provide your own resultset_class, inherit from InflateColumn::FS::ResultSet. don't skip that step, it's not optional, fr fr.


πŸŽ€ SUPPORT πŸŽ€

community support can be found via:

the author is semifor on IRC and a member of the mailing list. come say hi, we don't bite πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

semifor: Marc Mims <marc@questright.com>


🌟 CONTRIBUTORS 🌟

  • mst: Matt S. Trout <mst@shadowcatsystems.co.uk>
  • mo: Moritz Onken <onken@netcubed.de>
  • norbi: Norbert Buchmuller <norbi@nix.hu>

πŸ“œ LICENSE πŸ“œ

you may distribute this code under the same terms as Perl itself. slay, legally πŸ’…


and that's the whole page bestie!! this manual page is from perl v5.32.0, dated 2021-01-07, and the page itself is DBIx::...mn::FS(3pm) β€” mwah, go inflate something πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from