NAME

DustyDB::Object - use this class to declare a model to store

VERSION

version 0.06

SYNOPSIS

  package Song;
  use DustyDB::Object;

  has key title => ( is => 'rw', isa => 'Str', required => 1 );
  has artist => ( is => 'rw', isa => 'Str' );

DESCRIPTION

This is a special Moose extension that causes any module that uses it to become a model that may be stored in DustyDB. The class will automatically be given the methods and attributes of the DustyDB::Record role. The meta-class will gain an additional meta-class role, DustyDB::Meta::Class, containing the low-level storage routines. Finally, all the attributes will have additional features added through DustyDB::Meta::Attribute, such as the ability to assign an encoder and decoder subroutine.

METHODS

key

  has key foo => ( is => 'rw', isa => 'Str' );

This provides some sugar for defining the key fields of your model. The above is essentially the same as:

  has foo => ( is => 'rw', isa => 'Str', traits => [ 'DustyDB::Key' ] );