NAME
Doodle::Table::Helpers
ABSTRACT
Doodle Table Helpers
SYNOPSIS
use Doodle;
use Doodle::Table;
my $ddl = Doodle->new;
my $self = Doodle::Table->new(
name => 'users',
doodle => $ddl
);
DESCRIPTION
Helpers for configuring Table classes.
LIBRARIES
This package uses type constraints from:
METHODS
This package implements the following methods:
binary
binary(Str $name, Any %args) : Column
Registers a binary column and returns the Command object set.
boolean
boolean(Str $name, Any %args) : Column
Registers a boolean column and returns the Command object set.
char
char(Str $name, Any %args) : Column
Registers a char column and returns the Command object set.
date
date(Str $name, Any %args) : Column
Registers a date column and returns the Command object set.
datetime
datetime(Str $name, Any %args) : Column
Registers a datetime column and returns the Command object set.
datetime_tz
datetime_tz(Str $name, Any %args) : Column
Registers a datetime column with timezone and returns the Command object set.
decimal
decimal(Str $name, Any %args) : Column
Registers a decimal column and returns the Command object set.
double
double(Str $name, Any %args) : Column
Registers a double column and returns the Command object set.
enum
enum(Str $name, Any %args) : Column
Registers an enum column and returns the Command object set.
- enum example #1
-
# given: synopsis my $enum = $self->enum('colors', options => [ 'red', 'blue', 'green' ]);
float
float(Str $name, Any %args) : Column
Registers a float column and returns the Command object set.
if_exists
if_exists() : Table
Used with the delete
method to denote that the table should be deleted only if it already exists.
if_not_exists
if_not_exists() : Table
Used with the create
method to denote that the table should be created only if it doesn't already exist.
increments_big
increments_big(Str $name, Any %args) : Column
Registers an auto-incrementing big integer (8-byte) column and returns the Command object set.
increments_medium
increments_medium(Str $name, Any %args) : Column
Registers an auto-incrementing medium integer (3-byte) column and returns the Command object set.
- increments_medium example #1
-
# given: synopsis my $increments_medium = $self->increments_medium('number');
increments_small
increments_small(Str $name, Any %args) : Column
Registers an auto-incrementing small integer (2-byte) column and returns the Command object set.
- increments_small example #1
-
# given: synopsis my $increments_small = $self->increments_small('number');
integer
integer(Str $name, Any %args) : Column
Registers an integer (4-byte) column and returns the Command object set.
integer_big
integer_big(Str $name, Any %args) : Column
Registers a big integer (8-byte) column and returns the Command object set.
integer_big_unsigned
integer_big_unsigned(Str $name, Any %args) : Column
Registers an unsigned big integer (8-byte) column and returns the Command object set.
- integer_big_unsigned example #1
-
# given: synopsis my $integer_big_unsigned = $self->integer_big_unsigned('number');
integer_medium
integer_medium(Str $name, Any %args) : Column
Registers a medium integer (3-byte) column and returns the Command object set.
integer_medium_unsigned
integer_medium_unsigned(Str $name, Any %args) : Column
Registers an unsigned medium integer (3-byte) column and returns the Command object set.
- integer_medium_unsigned example #1
-
# given: synopsis my $integer_medium_unsigned = $self->integer_medium_unsigned('number');
integer_small
integer_small(Str $name, Any %args) : Column
Registers a small integer (2-byte) column and returns the Command object set.
integer_small_unsigned
integer_small_unsigned(Str $name, Any %args) : Column
Registers an unsigned small integer (2-byte) column and returns the Command object set.
- integer_small_unsigned example #1
-
# given: synopsis my $integer_small_unsigned = $self->integer_small_unsigned('number');
integer_tiny
integer_tiny(Str $name, Any %args) : Column
Registers a tiny integer (1-byte) column and returns the Command object set.
integer_tiny_unsigned
integer_tiny_unsigned(Str $name, Any %args) : Column
Registers an unsigned tiny integer (1-byte) column and returns the Command object set.
- integer_tiny_unsigned example #1
-
# given: synopsis my $integer_tiny_unsigned = $self->integer_tiny_unsigned('number');
integer_unsigned
integer_unsigned(Str $name, Any %args) : Column
Registers an unsigned integer (4-byte) column and returns the Command object set.
- integer_unsigned example #1
-
# given: synopsis my $integer_unsigned = $self->integer_unsigned('number');
json
json(Str $name, Any %args) : Column
Registers a JSON column and returns the Command object set.
morphs
morphs(Str $name) : ArrayRef[Column]
Registers columns neccessary for polymorphism and returns the Column object set.
no_morphs
no_morphs(Str $name) : ArrayRef[Command]
Registers a drop for {name}_fkey
and {name}_type
polymorphic columns and returns the Command object set.
no_timestamps
no_timestamps() : ArrayRef[Command]
Registers a drop for created_at
, updated_at
and deleted_at
columns and returns the Command object set.
primary
primary(Str $name, Any %args) : Column
Registers primary key(s) and returns the Command object set.
string
string(Str $name, Any %args) : Column
Registers a string column and returns the Command object set.
temporary
temporary() : Table
Denotes that the table created should be a temporary one.
text
text(Str $name, Any %args) : Column
Registers a text column and returns the Command object set.
text_long
text_long(Str $name, Any %args) : Column
Registers a long text column and returns the Command object set.
text_medium
text_medium(Str $name, Any %args) : Column
Registers a medium text column and returns the Command object set.
time
time(Str $name, Any %args) : Column
Registers a time column and returns the Command object set.
time_tz
time_tz(Str $name, Any %args) : Column
Registers a time column with timezone and returns the Command object set.
timestamp
timestamp(Str $name, Any %args) : Column
Registers a timestamp column and returns the Command object set.
timestamp_tz
timestamp_tz(Str $name, Any %args) : Column
Registers a timestamp_tz column and returns the Command object set.
timestamps
timestamps() : ArrayRef[Column]
Registers created_at
, updated_at
and deleted_at
columns and returns the Command object set.
timestamps_tz
timestamps_tz() : ArrayRef[Column]
Registers created_at
, updated_at
and deleted_at
columns with timezone and returns the Command object set.
uuid
uuid(Str $name, Any %args) : Column
Registers a uuid column and returns the Command object set.
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".