class Jennifer::Model::EnumConverter(T)

Overview

Converts string value to given T crystal enum.

enum Category
  GOOD
  BAD
end

class Post < Jennifer::Model::Base
  mapping(
    # ...
    category: {type: Category, converter: Jennifer::Model::EnumConverter(Category)}
  )
end

Defined in:

jennifer/model/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 : Nil, options) : Nil #

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

[View source]