NAME

Doodle::Column::Helpers

ABSTRACT

Doodle Column Helpers

SYNOPSIS

use Doodle::Column;

use Doodle;
use Doodle::Column;
use Doodle::Table;

my $ddl = Doodle->new;

my $table = Doodle::Table->new(
  name => 'users',
  doodle => $ddl
);

my $self = Doodle::Column->new(
  name => 'id',
  table => $table,
  doodle => $ddl
);

DESCRIPTION

Helpers for configuring Column classes.

LIBRARIES

This package uses type constraints from:

Doodle::Library

METHODS

This package implements the following methods:

binary

binary(Any %args) : Column

Configures a binary column and returns itself.

binary example #1
# given: synopsis

my $binary = $self->binary;

boolean

boolean(Any %args) : Column

Configures a boolean column and returns itself.

boolean example #1
# given: synopsis

my $boolean = $self->boolean;

char

char(Any %args) : Column

Configures a char column and returns itself.

char example #1
# given: synopsis

my $char = $self->char;

date

date(Any %args) : Column

Configures a date column and returns itself.

date example #1
# given: synopsis

my $date = $self->date;

datetime

datetime(Any %args) : Column

Configures a datetime column and returns itself.

datetime example #1
# given: synopsis

my $datetime = $self->datetime;

datetime_tz

datetime_tz(Any %args) : Column

Configures a datetime column with timezone and returns itself.

datetime_tz example #1
# given: synopsis

my $datetime_tz = $self->datetime_tz;

decimal

decimal(Any %args) : Column

Configures a decimal column and returns itself.

decimal example #1
# given: synopsis

my $decimal = $self->decimal;

default

default(Str @args) : Column

Configures a default value and returns itself.

default example #1
# given: synopsis

my $default = $self->default(123);

# produces, default 123
default example #2
# given: synopsis

my $default = $self->default(string => 123);

# produces, default '123'
default example #3
# given: synopsis

my $default = $self->default(integer => 123);

# produces, default 123
default example #4
# given: synopsis

my $default = $self->default(function => 'current_timestamp');

# produces, default CURRENT_TIMESTAMP

default_current_date

default_current_date() : Column

Configures a CURRENT_DATE default value and returns itself.

default_current_date example #1
# given: synopsis

my $default = $self->default_current_date;

default_current_datetime

default_current_datetime() : Column

Configures a CURRENT_TIMESTAMP default value and returns itself.

default_current_datetime example #1
# given: synopsis

my $default = $self->default_current_datetime;

default_current_time

default_current_time() : Column

Configures a CURRENT_TIME default value and returns itself.

default_current_time example #1
# given: synopsis

my $default = $self->default_current_time;

double

double(Any %args) : Column

Configures a double column and returns itself.

double example #1
# given: synopsis

my $double = $self->double;

enum

enum(Any %args) : Column

Configures an enum column and returns itself.

enum example #1
# given: synopsis

my $enum = $self->enum(options => [
  'red', 'blue', 'green'
]);

float

float(Any %args) : Column

Configures a float column and returns itself.

float example #1
# given: synopsis

my $float = $self->float;

increments

increments() : Column

Denotes that the column auto-increments and returns the Column object.

increments example #1
# given: synopsis

my $increments = $self->increments;

increments_big

increments_big(Any %args) : Column

Configures an auto-incrementing big integer (8-byte) column and returns itself.

increments_big example #1
# given: synopsis

my $increments_big = $self->increments_big;

increments_medium

increments_medium(Any %args) : Column

Configures an auto-incrementing medium integer (3-byte) column and returns itself.

increments_medium example #1
# given: synopsis

my $increments_medium = $self->increments_medium;

increments_small

increments_small(Any %args) : Column

Configures an auto-incrementing small integer (2-byte) column and returns itself.

increments_small example #1
# given: synopsis

my $increments_small = $self->increments_small;

integer

integer(Any %args) : Column

Configures an integer (4-byte) column and returns itself.

integer example #1
# given: synopsis

my $integer = $self->integer;

integer_big

integer_big(Any %args) : Column

Configures a big integer (8-byte) column and returns itself.

integer_big example #1
# given: synopsis

my $integer_big = $self->integer_big;

integer_big_unsigned

integer_big_unsigned(Any %args) : Column

Configures an unsigned big integer (8-byte) column and returns itself.

integer_big_unsigned example #1
# given: synopsis

my $integer_big_unsigned = $self->integer_big_unsigned;

integer_medium

integer_medium(Any %args) : Column

Configures a medium integer (3-byte) column and returns itself.

integer_medium example #1
# given: synopsis

my $integer_medium = $self->integer_medium;

integer_medium_unsigned

integer_medium_unsigned(Any %args) : Column

Configures an unsigned medium integer (3-byte) column and returns itself.

integer_medium_unsigned example #1
# given: synopsis

my $integer_medium_unsigned = $self->integer_medium_unsigned;

integer_small

integer_small(Any %args) : Column

Configures a small integer (2-byte) column and returns itself.

integer_small example #1
# given: synopsis

my $integer_small = $self->integer_small;

integer_small_unsigned

integer_small_unsigned(Any %args) : Column

Configures an unsigned small integer (2-byte) column and returns itself.

integer_small_unsigned example #1
# given: synopsis

my $integer_small_unsigned = $self->integer_small_unsigned;

integer_tiny

integer_tiny(Any %args) : Column

Configures a tiny integer (1-byte) column and returns itself.

integer_tiny example #1
# given: synopsis

my $integer_tiny = $self->integer_tiny;

integer_tiny_unsigned

integer_tiny_unsigned(Any %args) : Column

Configures an unsigned tiny integer (1-byte) column and returns itself.

integer_tiny_unsigned example #1
# given: synopsis

my $integer_tiny_unsigned = $self->integer_tiny_unsigned;

integer_unsigned

integer_unsigned(Any %args) : Column

Configures an unsigned integer (4-byte) column and returns itself.

integer_unsigned example #1
# given: synopsis

my $integer_unsigned = $self->integer_unsigned;

json

json(Any %args) : Column

Configures a JSON column and returns itself.

json example #1
# given: synopsis

my $json = $self->json;

not_null

not_null(Any %args) : Column

Denotes that the Column is not nullable and returns itself.

not_null example #1
# given: synopsis

my $not_null = $self->not_null;

null

null(Any %args) : Column

Denotes that the Column is nullable and returns itself.

null example #1
# given: synopsis

my $null = $self->null;

primary

primary(Any %args) : Column

Denotes that the column is the primary key and returns the Column object.

primary example #1
# given: synopsis

my $primary = $self->primary('id');

references

references(Str $table, Str $column) : Relation

Configures a relation and returns the Relation object.

references example #1
# given: synopsis

my $references = $self->references('entities');
references example #2
# given: synopsis

my $references = $self->references('entities', 'uuid');

string

string(Any %args) : Column

Configures a string column and returns itself.

string example #1
# given: synopsis

my $string = $self->string;

text

text(Any %args) : Column

Configures a text column and returns itself.

text example #1
# given: synopsis

my $text = $self->text;

text_long

text_long(Any %args) : Column

Configures a long text column and returns itself.

text_long example #1
# given: synopsis

my $text_long = $self->text_long;

text_medium

text_medium(Any %args) : Column

Configures a medium text column and returns itself.

text_medium example #1
# given: synopsis

my $text_medium = $self->text_medium;

time

time(Any %args) : Column

Configures a time column and returns itself.

time example #1
# given: synopsis

my $time = $self->time;

time_tz

time_tz(Any %args) : Column

Configures a time column with timezone and returns itself.

time_tz example #1
# given: synopsis

my $time_tz = $self->time_tz;

timestamp

timestamp(Any %args) : Column

Configures a timestamp column and returns itself.

timestamp example #1
# given: synopsis

my $timestamp = $self->timestamp;

timestamp_tz

timestamp_tz(Any %args) : Column

Configures a timestamp_tz column and returns itself.

timestamp_tz example #1
# given: synopsis

my $timestamp_tz = $self->timestamp_tz;

uuid

uuid(Any %args) : Column

Configures a uuid column and returns itself.

uuid example #1
# given: synopsis

my $uuid = $self->uuid;

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