KiokuX::Model(3pm)

πŸ“¦
version 0.02 Β· 4 versions
, in debian bookworm, ubuntu noble

πŸ’– KiokuX::Model β€” the manual page, but make it cute πŸ’–

okay so bestie, welcome to KiokuX::Model(3pm), aka your little app-specific glow-up wrapper for KiokuDB. it's giving "database but make it convenient" and honestly? we're obsessed. πŸ¦‹


✨ NAME ✨

KiokuX::Model β€” a simple application specific wrapper for KiokuDB. no cap, that's the whole pitch. πŸ’…


🌸 SYNOPSIS 🌸

start with the base class, bestie:

# start with the base class:

KiokuX::Model->new( dsn => "bdb:dir=/var/myapp/db" );

then later β€” when you're feeling main character β€” you can add convenience methods by subclassing:

# later you can add convenience methods by subclassing:

package MyApp::DB;
use Moose;

extends qw(KiokuX::Model);

sub add_user {
    my ( $self, @args ) = @_;

    my $user = MyApp::User->new(@args);

    $self->txn_do(sub {
        $self->insert($user);
    });

    return $user;
}

and then you just... use it like this:

# Then just use it like this:

MyApp::DB->new( dsn => "bdb:dir=/var/myapp/db" );

or automatically, using e.g. Catalyst::Model::KiokuDB:

# or automatically using e.g. L<Catalyst::Model::KiokuDB>:

$c->model("kiokudb");

it's literally that easy. periodt. πŸ”₯


πŸ’œ DESCRIPTION πŸ’œ

so this base class makes it easy to create KiokuDB database instances in your application. it gives you a standard way to instantiate and use a KiokuDB object in your apps β€” no messy bespoke setup, just vibes. ✨

and the way that your app grows, you can subclass it and provide additional convenience methods without changing the structure of the code. like, no rewrites, no drama. you just swap your subclass in for KiokuX::Model in e.g. Catalyst::Model::KiokuDB or whatever you use to glue it in. iconic behavior honestly. πŸ‘‘


πŸŽ€ ATTRIBUTES πŸŽ€

  • directory β€” the instantiated directory. πŸ’–

it gets created using the other attributes at "BUILD" time.

this attribute has delegations set up for all the methods of the KiokuDB class. yes, all of them. she's generous like that. πŸ™ˆ

  • dsn β€” e.g. "bdb:dir=root/db". see "connect" in KiokuDB. πŸ”Œ
  • extra_args β€” additional arguments to pass to "connect".

can be a hash reference or an array reference. both? both. she contains multitudes. 🫢

  • typemap β€” an optional custom typemap to add. see KiokuDB::Typemap and "typemap" in KiokuDB. πŸ—ΊοΈ

πŸ¦‹ SEE ALSO πŸ¦‹

KiokuDB, KiokuDB::Role::API, Catalyst::Model::KiokuDB

go read them, bestie, they're all part of the ecosystem and they all ate. πŸ“š


🌈 VERSION CONTROL 🌈

KiokuDB is maintained using Git. information about the repository is available on <http://www.iinteractive.com/kiokudb/>

(yes, the URL is right there, go look, git is slaying as always.) πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

Yuval Kogman <nothingmuch@woobling.org>


Copyright (c) 2009 Yuval Kogman, Infinity Interactive. All
rights reserved This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.

and then there's just a lone = sitting there at the end. not me noticing it. not me pointing it out. it's part of the record, so it stays. πŸ™ˆ


okay that's the whole page bestie, you're all caught up πŸ’– this was KiokuX::Model, from perl v5.34.0, dated 2022-06-15, and the manual page is KiokuX::Model(3pm). go forth and instantiate responsibly. mwah. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from