class

Marten::Schema::Field::String

Inherits Marten::Schema::Field::Base / Marten::Template::Object::Auto / Marten::Template::Object / Marten::Template::CanDefineTemplateAttributes / Reference / Object

Represents a string schema field.

Constructors

new(id : ::String, required : ::Bool = true, max_size : Int32 | Nil = nil, min_size : Int32 | Nil = nil, strip : ::Bool = true)
Source

Instance methods

deserialize(value) : ::String | Nil

Deserializes a raw field value to the corresponding field value.

Source
max_size

Returns the maximum string size allowed.

Source
min_size

Returns the minimum string size allowed.

Source
serialize(value) : ::Array(::String) | Nil | ::String

Serializes a field value.

Source
strip?

Returns true if the string value should be stripped of leading and trailing whitespaces.

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

Source