NAME
Doodle
ABSTRACT
Database DDL (= Data Definition Language) Statement Builder
SYNOPSIS
use Doodle;
my $self = Doodle->new;
my $table = $self->table('users');
$table->primary('id');
$table->uuid('arid');
$table->column('name');
$table->string('email');
$table->json('metadata');
my $command = $table->create;
my $grammar = $self->grammar('sqlite');
my $statement = $grammar->execute($command);
# say $statement->sql;
# create table "users" (
# "id" integer primary key,
# "arid" varchar,
# "name" varchar,
# "email" varchar,
# "metadata" text
# )
DESCRIPTION
Doodle is a database DDL ("Data Definition Language" or "Data Description Language") statement builder and provides an object-oriented abstraction for performing schema changes in various datastores. This class consumes the Doodle::Helpers roles.
INTEGRATES
This package integrates behaviors from:
LIBRARIES
This package uses type constraints from:
ATTRIBUTES
This package has the following attributes:
commands
commands(Commands)
This attribute is read-only, accepts (Commands)
values, and is optional.
METHODS
This package implements the following methods:
build
build(Grammar $grammar, CodeRef $callback) : Any
Execute a given callback for each generated SQL statement.
- build example #1
-
# given: synopsis $self->build($grammar, sub { my $statement = shift; # e.g. $db->do($statement->sql); });
grammar
grammar(Str $name) : Grammar
Returns a new Grammar object.
schema
schema(Str $name, Any %args) : Schema
Returns a new Schema object.
statements
statements(Grammar $g) : Statements
Returns a set of Statement objects for the given grammar.
table
table(Str $name, Any %args) : Table
Return a new Table object.
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".