class

Marten::DB::Field::Enum

Inherits Marten::DB::Field::Base / Reference / Object

Represents an enum field.

Constructors

new(id : ::String, enum_values : Array(::String), primary_key = false, blank = false, null = false, unique = false, index = false, db_column = nil, default : ::Enum | Nil = nil, **kwargs)
Source

Instance methods

default

Returns the default value of the field if any.

Source
from_db(value) : ::String | Nil

Converts the raw DB value to the corresponding field value.

Source
from_db_result_set(result_set : ::DB::ResultSet) : ::String | Nil

Extracts the field value from a DB result set and returns the right object corresponding to this value.

Source
to_column

Returns a migration column object corresponding to the field at hand.

Source
to_db(value) : ::DB::Any

Converts the field value to the corresponding DB value.

Source
values
Source