SQL::Engine::Grammar::Postgres
Grammar For PostgreSQL
SQL::Engine Grammar For PostgreSQL
method: column_change method: transaction method: type_binary method: type_boolean method: type_char method: type_date method: type_datetime method: type_datetime_wtz method: type_decimal method: type_double method: type_enum method: type_float method: type_integer method: type_integer_big method: type_integer_big_unsigned method: type_integer_medium method: type_integer_medium_unsigned method: type_integer_small method: type_integer_small_unsigned method: type_integer_tiny method: type_integer_tiny_unsigned method: type_integer_unsigned method: type_json method: type_number method: type_string method: type_text method: type_text_long method: type_text_medium method: type_time method: type_time_wtz method: type_timestamp method: type_timestamp_wtz method: type_uuid method: wrap
use SQL::Engine::Grammar::Postgres;
my $grammar = SQL::Engine::Grammar::Postgres->new(
schema => {
select => {
from => {
table => 'users'
},
columns => [
{
column => '*'
}
]
}
}
);
# $grammar->execute;
Types::Standard
SQL::Engine::Grammar
This package provides methods for converting json-sql data structures into PostgreSQL statements.
The column_change method generates SQL statements to change a column definition.
column_change(HashRef $data) : Object
=example-1 column_change
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'});
The transaction method generates SQL statements to commit an atomic database transaction.
transaction(HashRef $data) : Object
=example-1 transaction
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'});
The type_binary method returns the SQL expression representing a binary data type.
type_binary(HashRef $data) : Str
=example-1 type_binary
# given: synopsis
$grammar->type_binary({});
# bytea
The type_boolean method returns the SQL expression representing a boolean data type.
type_boolean(HashRef $data) : Str
=example-1 type_boolean
# given: synopsis
$grammar->type_boolean({});
# boolean
The type_char method returns the SQL expression representing a char data type.
type_char(HashRef $data) : Str
=example-1 type_char
# given: synopsis
$grammar->type_char({});
# char(1)
The type_date method returns the SQL expression representing a date data type.
type_date(HashRef $data) : Str
=example-1 type_date
# given: synopsis
$grammar->type_date({});
# date
The type_datetime method returns the SQL expression representing a datetime data type.
type_datetime(HashRef $data) : Str
=example-1 type_datetime
# given: synopsis
$grammar->type_datetime({});
# timestamp(0) without time zone
The type_datetime_wtz method returns the SQL expression representing a datetime (and timezone) data type.
type_datetime_wtz(HashRef $data) : Str
=example-1 type_datetime_wtz
# given: synopsis
$grammar->type_datetime_wtz({});
# timestamp(0) with time zone
The type_decimal method returns the SQL expression representing a decimal data type.
type_decimal(HashRef $data) : Str
=example-1 type_decimal
# given: synopsis
$grammar->type_decimal({});
# decimal(NULL, NULL)
The type_double method returns the SQL expression representing a double data type.
type_double(HashRef $data) : Str
=example-1 type_double
# given: synopsis
$grammar->type_double({});
# double precision
The type_enum method returns the SQL expression representing a enum data type.
type_enum(HashRef $data) : Str
=example-1 type_enum
# given: synopsis
$grammar->type_enum({ name => 'theme', options => ['light', 'dark'] });
# varchar(225) check ("theme" in ('light', 'dark'))
The type_float method returns the SQL expression representing a float data type.
type_float(HashRef $data) : Str
=example-1 type_float
# given: synopsis
$grammar->type_float({});
# double precision
The type_integer method returns the SQL expression representing a integer data type.
type_integer(HashRef $data) : Str
=example-1 type_integer
# given: synopsis
$grammar->type_integer({});
# integer
The type_integer_big method returns the SQL expression representing a big-integer data type.
type_integer_big(HashRef $data) : Str
=example-1 type_integer_big
# given: synopsis
$grammar->type_integer_big({});
# bigint
The type_integer_big_unsigned method returns the SQL expression representing a big unsigned integer data type.
type_integer_big_unsigned(HashRef $data) : Str
=example-1 type_integer_big_unsigned
# given: synopsis
$grammar->type_integer_big_unsigned({});
# bigint
The type_integer_medium method returns the SQL expression representing a medium integer data type.
type_integer_medium(HashRef $data) : Str
=example-1 type_integer_medium
# given: synopsis
$grammar->type_integer_medium({});
# integer
The type_integer_medium_unsigned method returns the SQL expression representing a unsigned medium integer data type.
type_integer_medium_unsigned(HashRef $data) : Str
=example-1 type_integer_medium_unsigned
# given: synopsis
$grammar->type_integer_medium_unsigned({});
# integer
The type_integer_small method returns the SQL expression representing a small integer data type.
type_integer_small(HashRef $data) : Str
=example-1 type_integer_small
# given: synopsis
$grammar->type_integer_small({});
# smallint
The type_integer_small_unsigned method returns the SQL expression representing a unsigned small integer data type.
type_integer_small_unsigned(HashRef $data) : Str
=example-1 type_integer_small_unsigned
# given: synopsis
$grammar->type_integer_small_unsigned({});
# smallint
The type_integer_tiny method returns the SQL expression representing a tiny integer data type.
type_integer_tiny(HashRef $data) : Str
=example-1 type_integer_tiny
# given: synopsis
$grammar->type_integer_tiny({});
# smallint
The type_integer_tiny_unsigned method returns the SQL expression representing a unsigned tiny integer data type.
type_integer_tiny_unsigned(HashRef $data) : Str
=example-1 type_integer_tiny_unsigned
# given: synopsis
$grammar->type_integer_tiny_unsigned({});
# smallint
The type_integer_unsigned method returns the SQL expression representing a unsigned integer data type.
type_integer_unsigned(HashRef $data) : Str
=example-1 type_integer_unsigned
# given: synopsis
$grammar->type_integer_unsigned({});
# integer
The type_json method returns the SQL expression representing a json data type.
type_json(HashRef $data) : Str
=example-1 type_json
# given: synopsis
$grammar->type_json({});
# json
The type_number method returns the SQL expression representing a number data type.
type_number(HashRef $data) : Str
=example-1 type_number
# given: synopsis
$grammar->type_number({});
# integer
The type_string method returns the SQL expression representing a string data type.
type_string(HashRef $data) : Str
=example-1 type_string
# given: synopsis
$grammar->type_string({});
# varchar(255)
The type_text method returns the SQL expression representing a text data type.
type_text(HashRef $data) : Str
=example-1 type_text
# given: synopsis
$grammar->type_text({});
# text
The type_text_long method returns the SQL expression representing a long text data type.
type_text_long(HashRef $data) : Str
=example-1 type_text_long
# given: synopsis
$grammar->type_text_long({});
# text
The type_text_medium method returns the SQL expression representing a medium text data type.
type_text_medium(HashRef $data) : Str
=example-1 type_text_medium
# given: synopsis
$grammar->type_text_medium({});
# text
The type_time method returns the SQL expression representing a time data type.
type_time(HashRef $data) : Str
=example-1 type_time
# given: synopsis
$grammar->type_time({});
# time(0) without time zone
The type_time_wtz method returns the SQL expression representing a time (and timezone) data type.
type_time_wtz(HashRef $data) : Str
=example-1 type_time_wtz
# given: synopsis
$grammar->type_time_wtz({});
# time(0) with time zone
The type_timestamp method returns the SQL expression representing a timestamp data type.
type_timestamp(HashRef $data) : Str
=example-1 type_timestamp
# given: synopsis
$grammar->type_timestamp({});
# timestamp(0) without time zone
The type_timestamp_wtz method returns the SQL expression representing a timestamp (and timezone) data type.
type_timestamp_wtz(HashRef $data) : Str
=example-1 type_timestamp_wtz
# given: synopsis
$grammar->type_timestamp_wtz({});
# timestamp(0) with time zone
The type_uuid method returns the SQL expression representing a uuid data type.
type_uuid(HashRef $data) : Str
=example-1 type_uuid
# given: synopsis
$grammar->type_uuid({});
# uuid
The wrap method returns a SQL-escaped string.
wrap(Str $name) : Str
=example-1 wrap
# given: synopsis
$grammar->wrap('field');
# "field"
76 POD Errors
The following errors were encountered while parsing the POD:
- Around line 10:
Unknown directive: =name
- Around line 16:
Unknown directive: =tagline
- Around line 22:
Unknown directive: =abstract
- Around line 28:
Unknown directive: =includes
- Around line 67:
Unknown directive: =synopsis
- Around line 90:
Unknown directive: =libraries
- Around line 96:
Unknown directive: =inherits
- Around line 102:
Unknown directive: =description
- Around line 110:
Unknown directive: =method
- Around line 115:
Unknown directive: =signature
- Around line 140:
Unknown directive: =method
- Around line 145:
Unknown directive: =signature
- Around line 176:
Unknown directive: =method
- Around line 181:
Unknown directive: =signature
- Around line 195:
Unknown directive: =method
- Around line 199:
Unknown directive: =signature
- Around line 213:
Unknown directive: =method
- Around line 217:
Unknown directive: =signature
- Around line 231:
Unknown directive: =method
- Around line 235:
Unknown directive: =signature
- Around line 249:
Unknown directive: =method
- Around line 254:
Unknown directive: =signature
- Around line 268:
Unknown directive: =method
- Around line 273:
Unknown directive: =signature
- Around line 287:
Unknown directive: =method
- Around line 292:
Unknown directive: =signature
- Around line 306:
Unknown directive: =method
- Around line 311:
Unknown directive: =signature
- Around line 325:
Unknown directive: =method
- Around line 329:
Unknown directive: =signature
- Around line 343:
Unknown directive: =method
- Around line 348:
Unknown directive: =signature
- Around line 362:
Unknown directive: =method
- Around line 367:
Unknown directive: =signature
- Around line 381:
Unknown directive: =method
- Around line 386:
Unknown directive: =signature
- Around line 400:
Unknown directive: =method
- Around line 405:
Unknown directive: =signature
- Around line 419:
Unknown directive: =method
- Around line 424:
Unknown directive: =signature
- Around line 438:
Unknown directive: =method
- Around line 443:
Unknown directive: =signature
- Around line 457:
Unknown directive: =method
- Around line 462:
Unknown directive: =signature
- Around line 476:
Unknown directive: =method
- Around line 481:
Unknown directive: =signature
- Around line 495:
Unknown directive: =method
- Around line 500:
Unknown directive: =signature
- Around line 514:
Unknown directive: =method
- Around line 519:
Unknown directive: =signature
- Around line 533:
Unknown directive: =method
- Around line 538:
Unknown directive: =signature
- Around line 552:
Unknown directive: =method
- Around line 556:
Unknown directive: =signature
- Around line 570:
Unknown directive: =method
- Around line 575:
Unknown directive: =signature
- Around line 589:
Unknown directive: =method
- Around line 594:
Unknown directive: =signature
- Around line 608:
Unknown directive: =method
- Around line 612:
Unknown directive: =signature
- Around line 626:
Unknown directive: =method
- Around line 631:
Unknown directive: =signature
- Around line 645:
Unknown directive: =method
- Around line 650:
Unknown directive: =signature
- Around line 664:
Unknown directive: =method
- Around line 668:
Unknown directive: =signature
- Around line 682:
Unknown directive: =method
- Around line 687:
Unknown directive: =signature
- Around line 701:
Unknown directive: =method
- Around line 706:
Unknown directive: =signature
- Around line 720:
Unknown directive: =method
- Around line 725:
Unknown directive: =signature
- Around line 739:
Unknown directive: =method
- Around line 743:
Unknown directive: =signature
- Around line 757:
Unknown directive: =method
- Around line 761:
Unknown directive: =signature