NAME

DBIx::QuickORM::Schema::Autofill - Autofill configuration for schema introspection.

DESCRIPTION

Holds the type maps, affinity callbacks, and hooks used while autofilling a schema from a live database. It maps introspected SQL types to DBIx::QuickORM::Type classes, runs user-supplied hooks at well-known points, and generates field and link accessors on autovivified row classes.

SYNOPSIS

my $autofill = DBIx::QuickORM::Schema::Autofill->new(
    types      => {...},
    affinities => {...},
    hooks      => {...},
);

$autofill->define_autorow($row_class, $table);

ATTRIBUTES

types

Hashref mapping SQL type names to type objects/classes.

affinities

Hashref mapping affinity names to arrayrefs of callbacks.

hooks

Hashref mapping hook names to arrayrefs of callbacks.

autorow

The autovivified row class configuration.

skip

Nested hashref describing what to skip during autofill.

PUBLIC METHODS

$bool = $autofill->is_valid_hook($name)

True if $name is a recognized hook name.

$out = $autofill->hook($name, \%args, $seed)

Run every callback registered for the named hook, threading the result through each call starting from $seed, and return the final value.

$val = $autofill->skip(@path)

Walk the nested skip hashref along @path, returning the value found or false (0) as soon as any step is missing.

$autofill->process_column(\%col)

Resolve the column's scalar-ref type into a real type object, using the type map first and then affinity callbacks. Updates the column's type and affinity in place when a match is found.

$autofill->define_autorow($row_class, $table)

Load (or autovivify) the row class, then install field accessors for each column and link accessors for each link, honoring the field_accessor and link_accessor hooks and never clobbering accessors that already exist.

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/