NAME

Yancy::Backend::Role::Relational - A role to give a relational backend relational capabilities

VERSION

version 1.027

SYNOPSIS

    package Yancy::Backend::RDBMS;
    with 'Yancy::Backend::Role::Relational';

DESCRIPTION

This role implements utility methods to make backend classes work with entity relations, using DBI methods such as DBI/foreign_key_info.

REQUIRED METHODS

The composing class must implement the following:

mojodb

The value must be a relative of Mojo::Pg et al.

mojodb_class

String naming the Mojo::* class.

mojodb_prefix

String with the value at the start of a DBI dsn.

filter_table

Called with a table name, returns a boolean of true to keep, false to discard - typically for a system table.

fixup_default

Called with a column's default value, returns the corrected version, which if undef means no default.

column_info_extra

Called with a table-name, and the array-ref returned by "column_info" in DBI, returns a hash-ref mapping column names to an "extra info" hash for that column, with possible keys:

auto_increment

a boolean

enum

an array-ref of allowed values

dbcatalog

Returns the DBI "catalog" argument for e.g. "column_info" in DBI.

dbschema

Returns the DBI "schema" argument for e.g. "column_info" in DBI.

METHODS

new

Self-explanatory, implements "new" in Yancy::Backend.

id_field

Given a schema, returns the string name of its ID field.

list_sqls

Given a schema, parameters and options, returns SQL to generate the actual results, the count results, and the bind-parameters.

normalize

Given a schema and data, normalises any boolean values to 1 and 0.

delete

Self-explanatory, implements "delete" in Yancy::Backend.

set

Self-explanatory, implements "set" in Yancy::Backend.

get

Self-explanatory, implements "get" in Yancy::Backend.

list

Self-explanatory, implements "list" in Yancy::Backend.

read_schema

Self-explanatory, implements "read_schema" in Yancy::Backend.

SEE ALSO

Yancy::Backend

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.