NAME

EntityModel::Storage::Perl - backend storage interface for EntityModel

VERSION

version 0.102

SYNOPSIS

See EntityModel.

DESCRIPTION

See EntityModel.

This does not really qualify as a 'storage' module, since it's intended purely for use in testing, providing an ephemeral backing store for entities which will disappear on program termination.

METHODS

setup

apply_entity

Set up this entity in storage, by adding it to the list of keys and clearing the existing max_id.

read_primary

Get the primary keys for a table.

read_fields

Read all fields for a given entity.

table_list

Get a list of all the existing tables in the schema.

field_list

Returns a list of all fields for the given table.

read

Reads the data for the given entity and returns hashref with the appropriate data.

Parameters:

Callbacks (included in parameter list above):

  • on_complete - called when the value has been read, includes the value

_next_id

Returns the next ID for the given entity. Not intended to be called outside this package; returns the value immediately rather than asynchronously.

create

Creates new entry for the given EntityModel::Entity.

Parameters:

Callbacks (included in parameter list above):

  • on_complete - called when the value has been created, will be passed the assigned ID

store

Stores data to the given entity and ID.

Parameters:

Callbacks (included in parameter list above):

  • on_complete - called when the value has been stored, will be passed the assigned ID

remove

Removes given ID from storage.

Parameters:

Callbacks (included in parameter list above):

  • on_complete - called when the value has been removed

find

Callbacks (included in parameter list above):

  • on_item - called for each item

  • on_not_found - called once if no items were found

  • on_complete - called when no more items are forthcoming (regardless of whether any were found or not)

adjacent

Returns the adjacent values for the given ID.

Callbacks (included in parameter list above):

  • on_prev - called with the value of the previous item

  • on_next - called with the value of the next item

  • on_complete - called when both next and previous values have been identified

outer

Returns the first and last values for the given ID.

Callbacks (included in parameter list above):

  • on_first - called with the value of the previous item

  • on_last - called with the value of the next item

  • on_complete - called when both next and previous values have been identified

INHERITED METHODS

EntityModel::Storage

apply_model, apply_model_and_schema, backend_ready, first, last, next, prev, register, transaction_commit, transaction_end, transaction_rollback, transaction_start, wait_for_backend

Mixin::Event::Dispatch

add_handler_for_event, clear_event_handlers, event_handlers, invoke_event, subscribe_to_event, unsubscribe_from_event

EntityModel::BaseClass

clone, new, sap

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2008-2011. Licensed under the same terms as Perl itself.