abstract class Marten::Schema::Field::Base
- Marten::Schema::Field::Base
- Reference
- Object
Overview
Abstract base schema field implementation.
Included Modules
Direct Known Subclasses
- Marten::Schema::Field::Bool
- Marten::Schema::Field::Date
- Marten::Schema::Field::DateTime
- Marten::Schema::Field::Duration
- Marten::Schema::Field::File
- Marten::Schema::Field::Float
- Marten::Schema::Field::Int
- Marten::Schema::Field::JSON
- Marten::Schema::Field::String
- Marten::Schema::Field::UUID
Defined in:
marten/schema/field/base.crmarten/template/ext/schema/field/base.cr
Constructors
Instance Method Summary
-
#deserialize(value)
Deserializes a raw field value to the corresponding field value.
-
#empty_value?(value) : ::Bool
Returns
true
if the value is considered empty by the field. -
#id : String
Returns the ID of the field used in the associated schema.
-
#required? : Bool
Returns a boolean indicating whether the field is required.
-
#serialize(value) : ::String | Nil
Serializes a field value.
-
#validate(schema, value)
Runs custom validation logic for a specific schema field and schema object.
Macros inherited from module Marten::Template::Object
template_attributes(*names)
template_attributes
Constructor Detail
Instance Method Detail
def validate(schema, value)
#
Runs custom validation logic for a specific schema field and schema object.
This method should be overriden for each field implementation that requires custom validation logic.