Class: PG::BinaryDecoder::Timestamp
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
PG::SimpleDecoder
|
Defined in: | ext/pg_binary_decoder.c |
Overview
This is a decoder class for conversion of PostgreSQL binary timestamps to Ruby Time objects.
The following flags can be used to specify timezone interpretation:
-
Coder::TIMESTAMP_DB_UTC : Interpret timestamp as UTC time (default)
-
Coder::TIMESTAMP_DB_LOCAL : Interpret timestamp as local time
-
Coder::TIMESTAMP_APP_UTC : Return timestamp as UTC time (default)
-
Coder::TIMESTAMP_APP_LOCAL : Return timestamp as local time
Example:
deco = PG::BinaryDecoder::Timestamp.new(flags: PG::Coder::TIMESTAMP_DB_UTC | PG::Coder::TIMESTAMP_APP_LOCAL)
deco.decode("\0"*8) # => 2000-01-01 01:00:00 +0100
Constant Summary
::PG::Coder
- Inherited
FORMAT_ERROR_MASK, FORMAT_ERROR_TO_PARTIAL, FORMAT_ERROR_TO_RAISE, FORMAT_ERROR_TO_STRING, TIMESTAMP_APP_LOCAL, TIMESTAMP_APP_UTC, TIMESTAMP_DB_LOCAL, TIMESTAMP_DB_UTC
Class Method Summary
::PG::Coder
- Inherited
.new | Create a new coder object based on the attribute Hash. |
Instance Attribute Summary
::PG::Coder
- Inherited
#flags | Get current bitwise OR-ed coder flags. |
#flags= | Set coder specific bitwise OR-ed flags. |
#format | The format code that is sent alongside with an encoded query parameter value. |
#format= | Specifies the format code that is sent alongside with an encoded query parameter value. |
#name | Name of the coder or the corresponding data type. |
#oid | The type OID that is sent alongside with an encoded query parameter value. |
#oid= | Specifies the type OID that is sent alongside with an encoded query parameter value. |
Instance Method Summary
::PG::Coder
- Inherited
#==, #dup, #inspect, #inspect_short, #marshal_dump, #marshal_load, | |
#to_h | Returns coder attributes as Hash. |
Constructor Details
This class inherits a constructor from PG::Coder