module Jennifer::Model::Base::AbstractClassMethods

Overview

Base class abstract methods.

Defined in:

jennifer/model/base.cr

Instance Method Summary

Instance Method Detail

abstract def coercer #

[View source]
abstract def columns_tuple #

Returns model's column metadata.

The metadata is a result of processing attributes passed to .mapping macro.


[View source]
abstract def field_count : Int32 #

Returns number of model's fields.


[View source]
abstract def field_names : Array(String) #

Returns array of field names.


[View source]
abstract def new(values : Hash | NamedTuple) #

Instantiate new object base on given values.

after_initialize callbacks are called after an object is initialized.

Contact.new({ "name" => "Jennifer" })
Contact.new({ :name => "Jennifer" })
Contact.new({ name: "Jennifer" })
Contact.new(:name: "Jennifer"})
# only in a case when all Contact's fields are nillable or with default values
Contact.new

[View source]
abstract def primary_auto_incrementable? #

Returns whether primary field is autoincrementable.


[View source]