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
$nameis a recognized hook name. - $out = $autofill->hook($name, \%args, $seed)
-
Run every callback registered for the named hook as a pipeline. Each hook has a designated seed key in
\%args(for exampletablefor the table hooks,namefor the accessor hooks). Every callback is called with the args (plusautofill) with the running value under the seed key, and its return value becomes the running value passed to the next callback and ultimately returned. A callback that modifies the seed in place must still return it so the callbacks after it (and the caller) see the same value. The pipeline starts from$seedwhen given, otherwise from the seed key's value in\%args; with a single registered callback this matches the old single-callback behavior exactly. - $val = $autofill->skip(@path)
-
Walk the nested
skiphashref 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
typeandaffinityin 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_accessorandlink_accessorhooks 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
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.