Doodle::Grammar
Doodle Grammar Base Class
use Doodle::Grammar; my $self = Doodle::Grammar->new;
This package determines how command objects should be interpreted to produce the correct DDL statements.
This package uses type constraints from:
Doodle::Library
This package has the following attributes:
name(Str)
This attribute is read-only, accepts (Str) values, and is optional.
(Str)
This package implements the following methods:
create_column(Command $command) : Str
Generate SQL statement for column-create Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $column = $ddl->table('users')->column('id'); my $command = $column->create; my $create_column = $self->create_column($command);
create_constraint(Column $column) : Str
Returns the SQL statement for the create constraint command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $relation = $ddl->table('emails')->relation('user_id', 'users', 'id'); my $command = $relation->create; $self->create_constraint($command);
create_index(Command $command) : Str
Generate SQL statement for index-create Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $index = $ddl->table('users')->index(columns => ['is_admin']); my $command = $index->create; my $create_index = $self->create_index($command);
create_schema(Command $command) : Str
Generate SQL statement for schema-create Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $schema = $ddl->schema('app'); my $command = $schema->create; my $create_schema = $self->create_schema($command);
create_table(Command $command) : Str
Generate SQL statement for table-create Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $table = $ddl->table('users'); my $command = $table->create; my $create_table = $self->create_table($command);
delete_column(Command $command) : Str
Generate SQL statement for column-delete Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $column = $ddl->table('users')->column('id'); my $command = $column->delete; my $delete_column = $self->delete_column($command);
delete_constraint(Column $column) : Str
Returns the SQL statement for the delete constraint command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $relation = $ddl->table('emails')->relation('user_id', 'users', 'id'); my $command = $relation->delete; $self->delete_constraint($command);
delete_index(Command $command) : Str
Generate SQL statement for index-delete Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $index = $ddl->table('users')->index(columns => ['is_admin']); my $command = $index->delete; my $delete_index = $self->delete_index($command);
delete_schema(Command $command) : Str
Generate SQL statement for schema-delete Command.
# given: synopsis my $ddl = Doodle->new; my $schema = $ddl->schema('app'); my $command = $schema->delete; my $delete_schema = $self->delete_schema($command);
delete_table(Command $command) : Str
Generate SQL statement for table-delete Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $table = $ddl->table('users'); my $command = $table->delete; my $delete_table = $self->delete_table($command);
exception(Str $message) : Any
Throws an exception using Carp confess.
# given: synopsis $self->exception('Oops');
execute(Command $command) : Statement
Processed the Command and returns a Statement object.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $column = $ddl->table('users')->column('id'); my $command = $column->create; my $statement = $self->execute($command);
rename_column(Command $command) : Str
Generate SQL statement for column-rename Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $column = $ddl->table('users')->column('id'); my $command = $column->rename('uuid'); my $rename_column = $self->rename_column($command);
rename_table(Command $command) : Str
Generate SQL statement for table-rename Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $table = $ddl->table('users'); my $command = $table->rename('people'); my $rename_table = $self->rename_table($command);
render(Command $command) : Str
Returns the SQL statement for the given Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $schema = $ddl->schema('app'); my $command = $schema->create; my $template = 'create schema {schema_name}'; my $sql = $self->render($template, $command);
update_column(Any @args) : Str
Generate SQL statement for column-update Command.
# given: synopsis use Doodle; my $ddl = Doodle->new; my $column = $ddl->table('users')->column('id')->integer_small; my $command = $column->update; my $update_column = $self->update_column($command);
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
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".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Doodle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Doodle
CPAN shell
perl -MCPAN -e shell install Doodle
For more information on module installation, please visit the detailed CPAN module installation guide.