class Jennifer::Model::EnumConverter(T)
- Jennifer::Model::EnumConverter(T)
- Reference
- Object
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.crClass Method Summary
- .from_db(pull, options)
- .from_hash(hash : Hash, column, options)
- .to_db(value : Nil, options) : Nil
- .to_db(value : T, options) : String