https://github.com/awncorp/doodle
Database DDL Statement Builder
https://github.com/awncorp/doodle
database ddl migrations perl perl5
Last synced: about 1 month ago
JSON representation
Database DDL Statement Builder
- Host: GitHub
- URL: https://github.com/awncorp/doodle
- Owner: awncorp
- License: other
- Created: 2020-10-03T19:06:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T20:35:55.000Z (over 5 years ago)
- Last Synced: 2025-11-11T10:02:58.709Z (7 months ago)
- Topics: database, ddl, migrations, perl, perl5
- Language: Perl
- Homepage:
- Size: 181 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGES
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
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:
Doodle::Helpers
LIBRARIES
This package uses type constraints from:
Doodle::Library
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.
grammar example #1
# given: synopsis
my $type = 'sqlite';
$grammar = $self->grammar($type);
schema
schema(Str $name, Any %args) : Schema
Returns a new Schema object.
schema example #1
# given: synopsis
my $name = 'app';
my $schema = $self->schema($name);
statements
statements(Grammar $g) : Statements
Returns a set of Statement objects for the given grammar.
statements example #1
# given: synopsis
my $statements = $self->statements($grammar);
table
table(Str $name, Any %args) : Table
Return a new Table object.
table example #1
# given: synopsis
my $name = 'users';
$table = $self->table($name);
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"
.
PROJECT
Wiki
Project
Initiatives
Milestones
Contributing
Issues