Class: PG::RecordCoder
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Coder
|
|
Instance Chain:
self,
Coder
|
|
Inherits: | PG::Coder |
Defined in: | ext/pg_record_coder.c, ext/pg_record_coder.c, lib/pg/coder.rb |
Overview
This is the base class for all type cast classes for COPY data,
Constant Summary
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
Instance Attribute Summary
-
#type_map ⇒ PG::TypeMap
rw
The
TypeMap
that will be used for encoding and decoding of columns. -
#type_map=(map)
rw
Defines how single columns are encoded or decoded.
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
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
Instance Attribute Details
#type_map ⇒ PG::TypeMap (rw)
The TypeMap
that will be used for encoding and decoding of columns.
# File 'ext/pg_record_coder.c', line 105
static VALUE pg_recordcoder_type_map_get(VALUE self) { t_pg_recordcoder *this = RTYPEDDATA_DATA( self ); return this->typemap; }
#type_map=(map) (rw)
Defines how single columns are encoded or decoded. map
must be a kind of TypeMap
.
Defaults to a TypeMapAllStrings
, so that TextEncoder::String
respectively TextDecoder::String
is used for encoding/decoding of each column.
# File 'ext/pg_record_coder.c', line 84
static VALUE pg_recordcoder_type_map_set(VALUE self, VALUE type_map) { t_pg_recordcoder *this = RTYPEDDATA_DATA( self ); rb_check_frozen(self); if ( !rb_obj_is_kind_of(type_map, rb_cTypeMap) ){ rb_raise( rb_eTypeError, "wrong elements type %s (expected some kind of PG::TypeMap)", rb_obj_classname( type_map ) ); } RB_OBJ_WRITE(self, &this->typemap, type_map); return type_map; }
Instance Method Details
#to_h
[ GitHub ]# File 'lib/pg/coder.rb', line 100
def to_h { **super, type_map: type_map, } end