NAME
SQL::Engine::Grammar::Postgres - Grammar For PostgreSQL
ABSTRACT
SQL::Engine Grammar For PostgreSQL
SYNOPSIS
use SQL::Engine::Grammar::Postgres;
my $grammar = SQL::Engine::Grammar::Postgres->new(
schema => {
select => {
from => {
table => 'users'
},
columns => [
{
column => '*'
}
]
}
}
);
# $grammar->execute;
DESCRIPTION
This package provides methods for converting json-sql data structures into PostgreSQL statements.
INHERITS
This package inherits behaviors from:
LIBRARIES
This package uses type constraints from:
METHODS
This package implements the following methods:
column_change
column_change(HashRef $data) : Object
The column_change method generates SQL statements to change a column definition.
- column_change example #1
-
my $grammar = SQL::Engine::Grammar::Postgres->new( schema => { 'column-change' => { for => { table => 'users' }, column => { name => 'accessed', type => 'datetime', nullable => 1 } } } ); $grammar->column_change($grammar->schema->{'column-change'});
transaction
transaction(HashRef $data) : Object
The transaction method generates SQL statements to commit an atomic database transaction.
- transaction example #1
-
my $grammar = SQL::Engine::Grammar::Postgres->new( schema => { 'transaction' => { queries => [ { 'table-create' => { name => 'users', columns => [ { name => 'id', type => 'integer', primary => 1 } ] } } ] } } ); $grammar->transaction($grammar->schema->{'transaction'});
type_binary
type_binary(HashRef $data) : Str
The type_binary method returns the SQL expression representing a binary data type.
type_boolean
type_boolean(HashRef $data) : Str
The type_boolean method returns the SQL expression representing a boolean data type.
type_char
type_char(HashRef $data) : Str
The type_char method returns the SQL expression representing a char data type.
type_date
type_date(HashRef $data) : Str
The type_date method returns the SQL expression representing a date data type.
type_datetime
type_datetime(HashRef $data) : Str
The type_datetime method returns the SQL expression representing a datetime data type.
- type_datetime example #1
-
# given: synopsis $grammar->type_datetime({}); # timestamp(0) without time zone
type_datetime_wtz
type_datetime_wtz(HashRef $data) : Str
The type_datetime_wtz method returns the SQL expression representing a datetime (and timezone) data type.
- type_datetime_wtz example #1
-
# given: synopsis $grammar->type_datetime_wtz({}); # timestamp(0) with time zone
type_decimal
type_decimal(HashRef $data) : Str
The type_decimal method returns the SQL expression representing a decimal data type.
type_double
type_double(HashRef $data) : Str
The type_double method returns the SQL expression representing a double data type.
type_enum
type_enum(HashRef $data) : Str
The type_enum method returns the SQL expression representing a enum data type.
- type_enum example #1
-
# given: synopsis $grammar->type_enum({ name => 'theme', options => ['light', 'dark'] }); # varchar(225) check ("theme" in ('light', 'dark'))
type_float
type_float(HashRef $data) : Str
The type_float method returns the SQL expression representing a float data type.
type_integer
type_integer(HashRef $data) : Str
The type_integer method returns the SQL expression representing a integer data type.
type_integer_big
type_integer_big(HashRef $data) : Str
The type_integer_big method returns the SQL expression representing a big-integer data type.
type_integer_big_unsigned
type_integer_big_unsigned(HashRef $data) : Str
The type_integer_big_unsigned method returns the SQL expression representing a big unsigned integer data type.
- type_integer_big_unsigned example #1
-
# given: synopsis $grammar->type_integer_big_unsigned({}); # bigint
type_integer_medium
type_integer_medium(HashRef $data) : Str
The type_integer_medium method returns the SQL expression representing a medium integer data type.
type_integer_medium_unsigned
type_integer_medium_unsigned(HashRef $data) : Str
The type_integer_medium_unsigned method returns the SQL expression representing a unsigned medium integer data type.
- type_integer_medium_unsigned example #1
-
# given: synopsis $grammar->type_integer_medium_unsigned({}); # integer
type_integer_small
type_integer_small(HashRef $data) : Str
The type_integer_small method returns the SQL expression representing a small integer data type.
type_integer_small_unsigned
type_integer_small_unsigned(HashRef $data) : Str
The type_integer_small_unsigned method returns the SQL expression representing a unsigned small integer data type.
- type_integer_small_unsigned example #1
-
# given: synopsis $grammar->type_integer_small_unsigned({}); # smallint
type_integer_tiny
type_integer_tiny(HashRef $data) : Str
The type_integer_tiny method returns the SQL expression representing a tiny integer data type.
type_integer_tiny_unsigned
type_integer_tiny_unsigned(HashRef $data) : Str
The type_integer_tiny_unsigned method returns the SQL expression representing a unsigned tiny integer data type.
- type_integer_tiny_unsigned example #1
-
# given: synopsis $grammar->type_integer_tiny_unsigned({}); # smallint
type_integer_unsigned
type_integer_unsigned(HashRef $data) : Str
The type_integer_unsigned method returns the SQL expression representing a unsigned integer data type.
type_json
type_json(HashRef $data) : Str
The type_json method returns the SQL expression representing a json data type.
type_number
type_number(HashRef $data) : Str
The type_number method returns the SQL expression representing a number data type.
type_string
type_string(HashRef $data) : Str
The type_string method returns the SQL expression representing a string data type.
type_text
type_text(HashRef $data) : Str
The type_text method returns the SQL expression representing a text data type.
type_text_long
type_text_long(HashRef $data) : Str
The type_text_long method returns the SQL expression representing a long text data type.
type_text_medium
type_text_medium(HashRef $data) : Str
The type_text_medium method returns the SQL expression representing a medium text data type.
type_time
type_time(HashRef $data) : Str
The type_time method returns the SQL expression representing a time data type.
type_time_wtz
type_time_wtz(HashRef $data) : Str
The type_time_wtz method returns the SQL expression representing a time (and timezone) data type.
type_timestamp
type_timestamp(HashRef $data) : Str
The type_timestamp method returns the SQL expression representing a timestamp data type.
- type_timestamp example #1
-
# given: synopsis $grammar->type_timestamp({}); # timestamp(0) without time zone
type_timestamp_wtz
type_timestamp_wtz(HashRef $data) : Str
The type_timestamp_wtz method returns the SQL expression representing a timestamp (and timezone) data type.
- type_timestamp_wtz example #1
-
# given: synopsis $grammar->type_timestamp_wtz({}); # timestamp(0) with time zone
type_uuid
type_uuid(HashRef $data) : Str
The type_uuid method returns the SQL expression representing a uuid data type.
wrap
wrap(Str $name) : Str
The wrap method returns a SQL-escaped string.
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".