NAME
DBIx::QuickORM::Role::Row - Role defining the common row interface.
DESCRIPTION
Shared behavior for row objects. Consumers provide the low-level state and field accessors (storage state, desync tracking, the various field views); this role builds the higher-level operations on top of them: insert / save / delete, primary-key helpers, field metadata lookups, and link traversal (follow, obtain, insert_related, siblings).
SYNOPSIS
package My::Row;
use Role::Tiny::With;
with 'DBIx::QuickORM::Role::Row';
sub source { ... }
# ...and the other required methods
$row->save;
my @sibs = $row->siblings('some_link');
REQUIRED METHODS
Consumers must provide the state predicates and accessors (source, connection, is_invalid, is_valid, in_storage, is_desynced, has_pending), the sync check (check_sync), the manipulation primitives (force_sync, refresh, discard, update), and the field views (field, raw_field, fields, raw_fields, stored_field, pending_field, raw_stored_field, raw_pending_field, stored_fields, pending_fields, raw_stored_fields, raw_pending_fields, field_is_desynced).
PUBLIC METHODS
- $bool = $row->track_desync
- $bool = $row->is_stored
- $dialect = $row->dialect
- $bool = $row->has_field($name)
- $affinity = $row->field_affinity($name)
- @fields = $row->primary_key_field_list
- @values = $row->primary_key_value_list
- %pk = $row->primary_key_hash
- $pk = $row->primary_key_hashref
-
Convenience accessors and primary-key helpers built on the source and connection.
has_fieldcroaks without a field name; theprimary_key_*helpers croak (viacheck_pk) when the source has no primary key.
- %args = $row->conflate_args($field, $value)
-
Return the argument list used for inflate/deflate of a single field value.
- $row = $row->insert_or_save
-
Save the row if it is already stored, or insert it if it has pending data.
- $row = $row->insert
-
Insert a not-yet-stored row that has pending data; croaks otherwise.
- $row = $row->save
-
Write pending changes for a stored row. Checks the primary key and sync state first; a no-op when there is nothing pending.
- $row->delete
-
Delete the row from storage (requires a primary key).
- $handle = $row->follow($link)
-
Return a handle for the rows reached by following
$linkfrom this row. - $row = $row->obtain($link)
-
Like
follow, but for a unique link: returns the single related row. -
Insert a related row across
$link, filling in the linking columns from this row. - $handle = $row->siblings($link_or_fields)
-
Return a handle for rows sharing the same values on the given link's local columns (or an explicit arrayref of fields); includes this row.
SOURCE
The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.