The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Database::Async::ORM - provides object-relational features for Database::Async

SYNOPSIS

 use 5.020;
 use IO::Async::Loop;
 use Database::Async::ORM;
 my $loop = IO::Async::Loop->new;
 $loop->add(
  my $orm = Database::Async::ORM->new
 );

 # Load schemata directly from the database
 $orm->load_from($db)
  ->then(sub {
   say 'We have the following tables:';
   $orm->tables
       ->map('name')
       ->say
       ->completed
  })->get;

 # Load schemata from a hashref (e.g. pulled
 # from a YAML/JSON/XML file or API)
 $orm->load_from({ ... })
  ->then(sub {
   $orm->apply_to($db)
  })->then(sub {
   say 'We have the following tables:';
   $orm->tables
       ->map('name')
       ->say
       ->completed
  })->get;

load_from

Loads schema, tables, types and any other available objects from a source - currently supports the following:

  • hashref

  • YAML file

  • directory of YAML files

You can call this multiple times to accumulate objects from various different sources.

Returns the current Database::Async::ORM instance.

METHODS - Internal

These are used by Database::Async::ORM and the precise API details may change in future.

populate_table

Populates a Database::Async::ORM::Table instance.

read_from

Reads data from a file or recursively from a base path.

SEE ALSO

AUTHOR

Tom Molesworth <TEAM@cpan.org>

LICENSE

Copyright Tom Molesworth 2018-2019. Licensed under the same terms as Perl itself.