The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DustyDB::Meta::Class - meta-class role for DustyDB::Record objects

VERSION

version 0.06

DESCRIPTION

This provides a number of meta-class methods to the meta-class of DustyDB model objects, i.e., a class that uses DustyDB::Object and does DustyDB::Record. These methods provide lower level access to the database and should be used with caution. This part of the API is more likely to change as well.

ATTRIBUTES

primary_key

This is currently implemented as an attribute. This might change in the future. This assumes that the primary key will not change at runtime (which is probably a pretty good assumption).

METHODS

load_object

  my $record = $meta->load_object( db => $db, key => [ %$key ] );

Load a record object from the given DustyDB with the given key parameters.

save_object

  my $key = $meta->save_object( db => $db, record => $record );

This saves the given record (an object that does DustyDB::Record) to the given DustyDB database. This method returns a hash referece representing a key that can be used to retrieve the object later via:

  my $record = $meta->load_object( db => $db, key => [ %$key ] );

delete_object

  $meta->delete_object( db => $db, record => $record );

Delete the record instance from the database.

list_all_objects

  my @records = $meta->list_all_objects( db => $db );

Fetches all the records for this object from the given DustyDB.