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

NAME

SimpleDB::Class::Types - Attribute types.

VERSION

version 1.0503

DESCRIPTION

The allowable value types for SimpleDB::Class::Item attributes.

SYNOPSIS

 Type                   | Default        | Range
 -----------------------+----------------+-----------------------------------------------
 Str                    | ''             | 0 to 1024 characters 
 MediumStr              | ''             | 0 to 259,080 chracters
 ArrayRefOfStr          | []             | 254 Str elements
 Int                    | 0              | -999,999,999 to 99,999,999,999,999 (no commas)
 ArrayRefOfInt          | []             | 254 Int elements
 DateTime               | now()          | Any DateTime object
 ArrayRefOfDateTime     | []             | 254 DateTime elements
 HashRef                | {}             | Less than 259,080 characters when converted to JSON

TYPES

The following types may be used to define attributes in SimpleDB::Class::Items.

Str

A string of less than 1024 characters. Defaults to ''. The basic working unit of SimpleDB. This is the fastest type as it needs no coercion, and is the native storage unit for SimpleDB. When in dobut, use this.

ArrayRefOfStr

An array reference of strings which can have up to 254 elements. Each string follows the rules of Str. This is your basic multi-value workhorse, as it is the fastest multi-value type. See Attribute Limits for special considerations about this type.

MediumStr

A string of up to 259,080 characters. Defaults to ''. Use this only if you need to store text larger than Str will allow. Much slower than Str and not reliably searchable or sortable. See Attribute Limits for special considerations about this type.

Int

An integer between -999,999,999 and 99,999,999,999,999 (without the commas). Defaults to 0. Is completely searchable and sortable.

ArrayRefOfInt

An array reference of integers which can have up to 254 elements. Each integer follows the rules of Int. If you need a multi-value integer type, this is the way to go. See Attribute Limits for special considerations about this type.

DateTime

A DateTime object. Defaults to:

 DateTime->now();

Store a precise date in the database. Is searchable and sortable.

ArrayRefOfDateTime

An array reference of dates which can have up to 254 elements. Each date follows the rules of DateTime. Use this if you need a multi-value date. See Attribute Limits for special considerations about this type.

HashRef

A hash reference. For storage this is serialized into JSON and stored as a MediumStr, therefore it cannot exceed 259,080 characters after serialization. You cannot use it to store a blessed hash reference. It is not searchable, not sortable, and is the slowest field type available. However, it can be quite useful if you need to persist a hash reference. See Attribute Limits for special considerations about this type.

Attribute Limits

SimpleDB Items are limited to 256 attributes each. This means that they can have no more than any combination of names, values, or multi values. So you can have 256 name/value pairs, or you could have one multi-valued attribute with 256 elements, or anything in between. For that reason, be careful when adding ArrayRefOfDateTime, ArrayRefOfInt, ArrayRefOfStr, MediumStr, and HashRef elements to your items.

LEGAL

SimpleDB::Class is Copyright 2009-2010 Plain Black Corporation (http://www.plainblack.com/) and is licensed under the same terms as Perl itself.