Skip to content

struct Athena::ORM::Mapping::Field
inherits Struct #

The mapping of a property to a column, as configured by AORMA::Column.

The field mappings of an entity are available from its class metadata, keyed by property name:

field = em.class_metadata(User).field_mappings["username"]

field.column_name # => "username"
field.type        # => "string"

It has the following properties:

Todo

There's no schema tool yet, so the properties describing the column's schema are recorded but have no effect.

Todo

The generated property isn't supported yet; AORMA::Column(generated: ...) is a compile-time error.

Constructors#

.new(field_name : String, column_name : String, type : String, length : Int32 | Nil = nil, precision : Int32 | Nil = nil, scale : Int32 | Nil = nil, unique : Bool | Nil = nil, nullable : Bool | Nil = nil, not_insertable : Bool | Nil = nil, not_updatable : Bool | Nil = nil, enum_type : String | Nil = nil, column_definition : String | Nil = nil, generated : String | Nil = nil, index : Bool = false, id : Bool | Nil = nil, quoted : Bool | Nil = nil)#

View source

Methods#

#clone#

View source

#column_definition : String | ::Nil#

#column_name : String#

#copy_with(field_name _field_name = @field_name, column_name _column_name = @column_name, type _type = @type, length _length = @length, precision _precision = @precision, scale _scale = @scale, unique _unique = @unique, nullable _nullable = @nullable, not_insertable _not_insertable = @not_insertable, not_updatable _not_updatable = @not_updatable, enum_type _enum_type = @enum_type, column_definition _column_definition = @column_definition, generated _generated = @generated, index _index = @index, id _id = @id, quoted _quoted = @quoted)#

View source

#enum_type : String | ::Nil#

#field_name : String#

#generated : String | ::Nil#

#id : Bool | ::Nil#

#index : Bool#

#length : Int32 | ::Nil#

#not_insertable : Bool | ::Nil#

#not_updatable : Bool | ::Nil#

#nullable : Bool | ::Nil#

#precision : Int32 | ::Nil#

#quoted : Bool | ::Nil#

#scale : Int32 | ::Nil#

#type : String#

#unique : Bool | ::Nil#