NAME

DBIx::QuickORM::Role::Source - Role for things that can be queried.

DESCRIPTION

A "source" is anything a query can run against: a table, a view, a join, or a literal SQL fragment. This role defines the interface the query and SQL layers rely on. Consumers include DBIx::QuickORM::Schema::Table, DBIx::QuickORM::Join, and DBIx::QuickORM::LiteralSource.

REQUIRED METHODS

$sql = $source->source_db_moniker

The SQL naming the source: a table name, "table AS alias", or literal SQL.

$name = $source->source_orm_name

The abstract source kind: TABLE, VIEW, JOIN, or LITERAL.

$class = $source->row_class
$cols = $source->primary_key
$type = $source->field_type($field)
$aff = $source->field_affinity($field, $dialect)
$bool = $source->has_field($field)
$db_name = $source->field_db_name($field)

The database name for a field, given either its ORM or database name. Idempotent and used by the SQL builder to emit database names; an unknown field is returned unchanged.

$orm_name = $source->field_orm_name($field)

The ORM name for a field, given either its ORM or database name. Idempotent and used to remap fetched result keys back to ORM names; an unknown field is returned unchanged.

$bool = $source->field_is_generated($field)

True if the named field is a database-generated column (stored or virtual GENERATED). Used by the row and SQL layers to keep generated columns out of INSERT / UPDATE column lists. Unknown fields return false.

$bool = $source->source_has_aliases

True when the source has any column whose ORM name differs from its database name. Lets the SQL and row layers skip name translation entirely when there is nothing to translate.

$fields = $source->fields_to_fetch
$fields = $source->fields_to_omit
$fields = $source->fields_list_all

SOURCE

The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

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.

See https://dev.perl.org/licenses/