class Jennifer::Model::PgEnumConverter
- Jennifer::Model::PgEnumConverter
- Reference
- Object
Overview
Type converter for Postgre ENUM field.
Postgre custom data types (to which ENUM belongs) may have different OID on different databases.
Therefore PG driver treats value of ENUM type as Bytes
. To bring dynamic convert to string value and back
use this converter
class Order < Jennifer::Model::Base
mapping(
id: Primary32,
title: String,
status: {type: String?, default: "draft", converter: Jennifer::Model::PgEnumConverter}
)
end
Defined in:
jennifer/adapter/postgres/model/pg_enum_converter.crClass Method Summary
- .from_db(pull, options)
- .from_hash(hash : Hash, column, options)
- .to_db(value : String, options)
- .to_db(value : Nil, options) : Nil