class DBModels::Character

Included Modules

Extended Modules

Defined in:

database.cr

Constant Summary

CRECTO_DESTROY_ASSOCIATIONS = Array(Symbol).new
CRECTO_ENUM_FIELDS = [] of NamedTuple(name: Symbol, type: String, column_name: String, column_type: String)
CRECTO_FIELDS = [{name: :account_id, type: Int32}, {name: :name, type: String}, {name: :job, type: String}, {name: :level, type: Int32}, {name: :look, type: Json}] of NamedTuple(name: Symbol, type: String)
CRECTO_MODEL_FIELDS = [] of NamedTuple(name: Symbol, type: String)
CRECTO_NULLIFY_ASSOCIATIONS = Array(Symbol).new
CRECTO_VALID_FIELD_OPTIONS = [:primary_key, :virtual, :default]
CRECTO_VALID_FIELD_TYPES = [String, Int64, Int32, Int16, Float32, Float64, Bool, Time, Int32 | Int64, Float32 | Float64, Json, PkeyValue, Array(String), Array(Int64), Array(Int32), Array(Int16), Array(Float32), Array(Float64), Array(Bool), Array(Time), Array(Int32 | Int64), Array(Float32 | Float64), Array(Json), Array(PkeyValue)]

macro constants

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

def self.new(__temp_88 : DB::ResultSet) #

def self.new #

[View source]

Class Method Detail

def self.add_destroy_association(a) #

[View source]
def self.add_nullify_association(a) #

[View source]
def self.association_type_for_association(association : Symbol) #

[View source]
def self.cast(attributes : NamedTuple, whitelist : Tuple = attributes.keys) #

[View source]
def self.cast(attributes : Hash(Symbol, T), whitelist : Array(Symbol) = attributes.keys) forall T #

[View source]
def self.cast(attributes : Hash(String, T), whitelist : Array(String) = attributes.keys) forall T #

[View source]
def self.cast(**attributes) #

Class methods for mass assignment


[View source]
def self.cast!(attributes : NamedTuple) #

[View source]
def self.cast!(**attributes : **T) forall T #

Class methods for compile-time type safe mass assignment


[View source]
def self.changeset_fields #

Class method to get the .changeset_fields


[View source]
def self.created_at_field #

[View source]
def self.destroy_associations #

[View source]
def self.fields #

[View source]
def self.foreign_key_for_association(association : Symbol) : Symbol | Nil #

[View source]
def self.foreign_key_for_association(klass : Crecto::Model.class) #

[View source]
def self.foreign_key_value_for_association(association : Symbol, item) #

[View source]
def self.from_rs(__temp_88 : DB::ResultSet) #

def self.klass_for_association(association : Symbol) #

Empty association methods Implementations are in the setup_association macro


[View source]
def self.nullify_associations #

[View source]
def self.primary_key_field #

Return the primary key field as a String


[View source]
def self.primary_key_field_symbol #

Return the primary key field as a Symbol


[View source]
def self.set_value_for_association(association : Symbol, item, items) #

[View source]
def self.table_name #

Class method to get the table name


[View source]
def self.through_key_for_association(association : Symbol) : Symbol | Nil #

[View source]
def self.updated_at_field #

[View source]
def self.use_primary_key? #

[View source]
def self.validate(message : String, block : DBModels::Character -> _) #

Validates generic block against an instance of the class


Instance Method Detail

def account_id : Int32? #

def account_id! #

Builds fields' cast typed method


def account_id=(_account_id : Int32 | Nil) #

def cast(attributes : NamedTuple, whitelist : Tuple = attributes.keys) #

def cast(attributes : Hash(Symbol, T), whitelist : Array(Symbol) = attributes.keys) forall T #

def cast(attributes : Hash(String, T), whitelist : Array(String) = attributes.keys) forall T #

def cast(**attributes : **T) forall T #

Empty instance methods for mass assignment Implementations are in the Schema.setup macro


def cast!(attributes : NamedTuple) #

[View source]
def cast!(**attributes : **T) forall T #

Instance method for compile-time type safe mass assignment


[View source]
def created_at : Time? #

def created_at=(_created_at : Time | Nil) #

def created_at_to_now #

def created_at_value #

def get_changeset #

[View source]
def id : Int16 | Int32 | Int64 | Int8 | String | Nil #

def id=(_id : PkeyValue | Nil) #

def initial_values : Hash(Symbol, DbValue) | Nil #

def initial_values=(initial_values : Hash(Symbol, DbValue) | Nil) #

def job : String? #

def job! #

def job=(_job : String | Nil) #

def level : Int32? #

def level! #

def level=(_level : Int32 | Nil) #

def look : JSON::Any? #

def look! #

def look=(_look : Json | Nil) #

def look=(val) #

def name : String? #

def name! #

def name=(_name : String | Nil) #

def pkey_value #

Returns the value of the primary key field


def to_query_hash(include_virtual = false) #

Builds a hash from all CRECTO_FIELDS defined


def update_from_hash(hash : Hash(String, DbValue)) #

def update_primary_key(val) #

def updated_at : Time? #

def updated_at=(_updated_at : Time | Nil) #

def updated_at_to_now #

def updated_at_value #