NAME
SimpleDB::Class::Domain - A schematic representation of a SimpleDB domain.
VERSION
version 1.0503
DESCRIPTION
A subclass of this class is created for each domain in SimpleDB with it's name, attributes, and relationships.
METHODS
The following methods are available from this class.
new ( params )
Constructor. Normally you should never call this method yourself, instead use the domain() method in SimpleDB::Class.
params
A hash containing the parameters needed to construct this object.
simpledb
Required. A reference to a SimpleDB::Class object.
name
Required. The SimpleDB domain name associated with this class.
item_class ( )
Returns the SimpleDB::Class::Item subclass name passed into the constructor.
name ( )
Returns the name determined automatically by the item_class passed into the constructor.
simpledb ( )
Returns the SimpleDB::Class object set in the constructor.
create ( )
Creates this domain in the SimpleDB.
delete ( )
Deletes this domain from the SimpleDB.
find ( id, [ options ] )
Retrieves an item from the SimpleDB by ID and then returns a SimpleDB::Class::Item object.
id
The unique identifier (called ItemName in AWS documentation) of the item to retrieve.
options
A hash which allows options to modify the retrieval.
consistent
A boolean that if set true will get around Eventual Consistency, but at a reduced performance. Note that since SimpleDB::Class fetches requests by id (like this one) directly from memcached, this option should never be needed. It is provided only for completeness.
set
A hash reference of attribute names paired with values that should be set as soon as the item is instantiated. This is useful for prefilling cache attributes, and is used by the belongs_to
method for that purpose. Doing so prevents stale object references.
insert ( attributes, [ options ] )
Adds a new item to this domain.
attributes
A hash reference of name value pairs to insert as attributes into this item.
options
A hash of extra options to modify the put.
id
Optionally specify a unqiue id for this item.
set
A hash reference of attribute names paired with values that should be set as soon as the item is instantiated. This is useful for prefilling cache attributes to prevent stale object references.
count ( [ options ] )
Returns an integer indicating how many items are in this domain.
WARNING: With this method you need to be aware that SimpleDB is eventually consistent. See "Eventual Consistency" in SimpleDB::Class for details.
options
A hash containing options to modify the count.
where
A where clause as defined in SimpleDB::Class::SQL if you want to count only a certain number of items in the domain.
consistent
A boolean that if set true will get around Eventual Consistency, but at a reduced performance.
fetch_ids ( [ options ] )
Returns an array reference of ids (itemName()s) in the domain.
WARNING: With this method you need to be aware that SimpleDB is eventually consistent. See "Eventual Consistency" in SimpleDB::Class for details.
options
A hash containing options to modify the array reference.
where
A where clause as defined in SimpleDB::Class::SQL if you want to fetch only a certain number of items in the domain.
consistent
Defaults to 0. A boolean that if set true will get around Eventual Consistency, but at a reduced performance.
max ( attribute, [ options ] )
Returns the maximum value of an attribute.
WARNING: With this method you need to be aware that SimpleDB is eventually consistent. See "Eventual Consistency" in SimpleDB::Class for details.
attribute
The name of the attribute to find the maximum value of.
options
A hash of options to modify the search.
where
A where clause as defined by SimpleDB::Class::SQL. An optional clause to limit the range of the maximum value.
consistent
A boolean that if set true will get around Eventual Consistency, but at a reduced performance.
min ( attribute, [ options ] )
Returns the minimum value of an attribute.
WARNING: With this method you need to be aware that SimpleDB is eventually consistent. See "Eventual Consistency" in SimpleDB::Class for details.
attribute
The name of the attribute to find the minimum value of.
options
A hash of extra options to modify the search.
where
A where clause as defined by SimpleDB::Class::SQL. An optional clause to limit the range of the minimum value.
consistent
A boolean that if set true will get around Eventual Consistency, but at a reduced performance.
search ( options )
Returns a SimpleDB::Class::ResultSet object.
WARNING: With this method you need to be aware that SimpleDB is eventually consistent. See "Eventual Consistency" in SimpleDB::Class for details.
options
A hash of options to set up the search.
where
A where clause as defined by SimpleDB::Class::SQL.
order_by
An order by clause as defined by SimpleDB::Class::SQL.
limit
A limit clause as defined by SimpleDB::Class::SQL.
consistent
A boolean that if set true will get around Eventual Consistency, but at a reduced performance.
set
A hash reference of attribute names paired with values that should be set as soon as the item is instantiated. This is useful for prefilling cache attributes as items come off the result set, and is used by the has_many
method for that purpose. Doing so prevents stale object references.
LEGAL
SimpleDB::Class is Copyright 2009-2010 Plain Black Corporation (http://www.plainblack.com/) and is licensed under the same terms as Perl itself.