| 1 | package Eve::PgSqlType; | ||
| 2 | |||
| 3 | 15 | ▶ | use parent qw(Eve::Class); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 15 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 15 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | use DBD::Pg (); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | B<Eve::PgSqlType> - a base class for PostgreSQL types. | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | package Eve::PgSqlType::Bigint; | ||
| 17 | |||
| 18 | use parent qw(Eve::PgSqlType); | ||
| 19 | |||
| 20 | # Some implementation here | ||
| 21 | |||
| 22 | 1; | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | B<Eve::PgSqlType> is an base class for all PostgreSQL type classes. | ||
| 27 | |||
| 28 | =head1 METHODS | ||
| 29 | |||
| 30 | =head2 B<get_type()> | ||
| 31 | |||
| 32 | It must be overridden. | ||
| 33 | |||
| 34 | =head3 Returns | ||
| 35 | |||
| 36 | A PostgreSQL data type value. See B<DBD::Pg> for more information. | ||
| 37 | |||
| 38 | =cut | ||
| 39 | |||
| 40 | sub get_type { | ||
| 41 | Eve::Error::NotImplemented->throw(); | ||
| 42 | } | ||
| 43 | |||
| 44 | =head2 B<wrap()> | ||
| 45 | |||
| 46 | If you need to implement some specific type you might be required to | ||
| 47 | add implicitly casting statement or do another wrapping operation with | ||
| 48 | the expression. | ||
| 49 | |||
| 50 | It must be overridden. | ||
| 51 | |||
| 52 | =head3 Arguments | ||
| 53 | |||
| 54 | =over 4 | ||
| 55 | |||
| 56 | =item C<expression> | ||
| 57 | |||
| 58 | a text expression to be wrapper. | ||
| 59 | |||
| 60 | =back | ||
| 61 | |||
| 62 | =head3 Returns | ||
| 63 | |||
| 64 | A wrapped expression text. | ||
| 65 | |||
| 66 | =cut | ||
| 67 | |||
| 68 | sub wrap { | ||
| 69 | #my ($self, %arg_hash) = @_; | ||
| 70 | #Eve::Support::arguments(\%arg_hash, my $expression); | ||
| 71 | |||
| 72 | Eve::Error::NotImplemented->throw(); | ||
| 73 | } | ||
| 74 | |||
| 75 | =head2 B<serialize()> | ||
| 76 | |||
| 77 | Serializes a value into the database representation. | ||
| 78 | |||
| 79 | It must be overriden. | ||
| 80 | |||
| 81 | =head3 Arguments | ||
| 82 | |||
| 83 | =over 4 | ||
| 84 | |||
| 85 | =item C<value> | ||
| 86 | |||
| 87 | a value to serialize. | ||
| 88 | |||
| 89 | =back | ||
| 90 | |||
| 91 | =head3 Returns | ||
| 92 | |||
| 93 | A serizlized value. | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | sub serialize { | ||
| 98 | #my ($self, %arg_hash) = @_; | ||
| 99 | #Eve::Support::arguments(\%arg_hash, my $value); | ||
| 100 | |||
| 101 | Eve::Error::NotImplemented->throw(); | ||
| 102 | } | ||
| 103 | |||
| 104 | =head2 B<deserialize()> | ||
| 105 | |||
| 106 | Deserializes a value from the database representation. | ||
| 107 | |||
| 108 | It must be overriden. | ||
| 109 | |||
| 110 | =head3 Arguments | ||
| 111 | |||
| 112 | =over 4 | ||
| 113 | |||
| 114 | =item C<value> | ||
| 115 | |||
| 116 | a value to deserialize. | ||
| 117 | |||
| 118 | =back | ||
| 119 | |||
| 120 | =head3 Returns | ||
| 121 | |||
| 122 | A deserizlized value. | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | sub deserialize { | ||
| 127 | #my ($self, %arg_hash) = @_; | ||
| 128 | #Eve::Support::arguments(\%arg_hash, my $value); | ||
| 129 | |||
| 130 | Eve::Error::NotImplemented->throw(); | ||
| 131 | } | ||
| 132 | |||
| 133 | =head1 SEE ALSO | ||
| 134 | |||
| 135 | =over 4 | ||
| 136 | |||
| 137 | =item L<DBI> | ||
| 138 | |||
| 139 | =item L<DBD::Pg> | ||
| 140 | |||
| 141 | =back | ||
| 142 | |||
| 143 | =head1 LICENSE AND COPYRIGHT | ||
| 144 | |||
| 145 | Copyright 2012 Igor Zinovyev. | ||
| 146 | |||
| 147 | This program is free software; you can redistribute it and/or modify it | ||
| 148 | under the terms of either: the GNU General Public License as published | ||
| 149 | by the Free Software Foundation; or the Artistic License. | ||
| 150 | |||
| 151 | See http://dev.perl.org/licenses/ for more information. | ||
| 152 | |||
| 153 | |||
| 154 | =head1 AUTHOR | ||
| 155 | |||
| 156 | =over 4 | ||
| 157 | |||
| 158 | =item L<Sergey Konoplev|mailto:gray.ru@gmail.com> | ||
| 159 | |||
| 160 | =back | ||
| 161 | |||
| 162 | =cut | ||
| 163 | |||
| 164 | 1; | ||