class Jennifer::Model::PgEnumConverter

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.cr

Class Method Summary

Class Method Detail

def self.from_db(pull, options) #

[View source]
def self.from_hash(hash : Hash, column, options) #

[View source]
def self.to_db(value : String, options) #

[View source]
def self.to_db(value : Nil, options) : Nil #

[View source]