class UserOrder

Included Modules

Defined in:

models/user_order.cr

Constant Summary

ASSOCIATIONS = [{type: BonusLog, assoc_name: bonus_log, foreign_key: :user_order_id, relationship_type: :has_one, through: nil}, {type: User, assoc_name: user, foreign_key: :user_id, relationship_type: :belongs_to, through: nil}] of Nil
BONUS = 10
COLUMNS = [{name: id, type: Int64, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: created_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: updated_at, type: Time, nilable: false, autogenerated: true, value: nil, serialized: false}, {name: user_id, type: User::PrimaryKeyType, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: product, type: String, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: price, type: Float64, nilable: false, autogenerated: false, value: nil, serialized: false}] of Nil
PRIMARY_KEY_NAME = :id
PRIMARY_KEY_TYPE = Int64

Constructors

Class Method Summary

Instance Method Summary

Class methods inherited from class BaseModel

database : Avram::Database.class database

Constructor Detail

def self.new(id : Int64, created_at : Time, updated_at : Time, user_id : Int64, product : String, price : Float64 | PG::Numeric) #

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

Class Method Detail

def self.column_names : Array(Symbol) #

def self.columns : Array(NamedTuple(name: Symbol, nilable: Bool, type: String)) #

def self.ensure_correct_column_mappings! #

def self.from_rs(__temp_119 : DB::ResultSet) #

def self.primary_key_name : Symbol | Nil #

def self.schema_enforcer_validations #

def self.table_name : String #

Instance Method Detail

def base_query_class : ::UserOrder::BaseQuery.class #

This makes it easy for plugins and extensions to use the base SaveOperation


def bonus_amount #

[View source]
def bonus_log : BonusLog | Nil #

def bonus_log! : BonusLog | Nil #

def bonus_log_query #

def created_at : Time #

def created_at=(_created_at : Time::Lucky::ColumnType) #

def delete_operation_class : ::UserOrder::DeleteOperation.class #

def id : Int64 #

def id=(_id : Int64::Lucky::ColumnType) #

def price : Float64 #

def price=(_price : Float64::Lucky::ColumnType) #

def product : String #

def product=(_product : String::Lucky::ColumnType) #

def save_operation_class : ::UserOrder::SaveOperation.class #

def updated_at : Time #

def updated_at=(_updated_at : Time::Lucky::ColumnType) #

def user : User #

def user! : User #

def user_count : Int64 #

def user_id : User::PrimaryKeyType #

def user_id=(_user_id : User::PrimaryKeyType::Lucky::ColumnType) #

def user_query #