class OrderItem

Included Modules

Defined in:

models/order_item.cr

Constant Summary

ASSOCIATIONS = [{type: Store, assoc_name: store, foreign_key: :store_id, relationship_type: :belongs_to, through: nil}, {type: Good, assoc_name: good, foreign_key: :good_id, relationship_type: :belongs_to, through: nil}] of Nil
COLUMNS = [{name: id, type: Int32, 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: store_id, type: Store::PrimaryKeyType, nilable: true, autogenerated: false, value: nil, serialized: false}, {name: good_id, type: Good::PrimaryKeyType, nilable: true, autogenerated: false, value: nil, serialized: false}, {name: order_type, type: String, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: order_id, type: Int32, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: price, type: Float64, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: weight_of_packaged_items, type: Float64, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: amount, type: Int16, nilable: false, autogenerated: false, value: nil, serialized: false}] of Nil
PRIMARY_KEY_NAME = :id
PRIMARY_KEY_TYPE = Int32

Constructors

Class Method Summary

Instance Method Summary

Class methods inherited from class BaseModel

database : Avram::Database.class database

Constructor Detail

def self.new(id : Int32, created_at : Time, updated_at : Time, store_id : Int32 | Nil, good_id : Int32 | Nil, order_type : String, order_id : Int32, price : PG::Numeric, weight_of_packaged_items : PG::Numeric, amount : Int16) #

def self.new(__temp_297 : 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_297 : DB::ResultSet) #

def self.primary_key_name : Symbol | Nil #

def self.schema_enforcer_validations #

def self.table_name : String #

Instance Method Detail

def _order_preloaded? : Bool #

def _preloaded_order : StoreOrder | UserOrder | Nil #

def amount : Int16 #

def amount=(_amount : Int16::Lucky::ColumnType) #

def base_query_class : ::OrderItem::BaseQuery.class #

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


def created_at : Time #

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

def delete_operation_class : ::OrderItem::DeleteOperation.class #

def good : Good | Nil #

def good! : Good | Nil #

def good_count : Int64 #

def good_id : Good::PrimaryKeyType | Nil #

def good_id=(_good_id : Good::PrimaryKeyType::Lucky::ColumnType | Nil) #

def good_query #

def id : Int32 #

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

def order : StoreOrder | UserOrder #

[View source]
def order! : StoreOrder | UserOrder #

Based on avram/src/avram/associations.cr, define_public_preloaded_getters


[View source]
def order_id : Int32 #

def order_id=(_order_id : Int32::Lucky::ColumnType) #

def order_type : String #

def order_type=(_order_type : String::Lucky::ColumnType) #

def price : Float64 #

def price=(_price : PG::Numeric) #

def save_operation_class : ::OrderItem::SaveOperation.class #

def set_preloaded_order(record : StoreOrder | UserOrder | Nil) #

[View source]
def store : Store | Nil #

def store! : Store | Nil #

def store_count : Int64 #

def store_id : Store::PrimaryKeyType | Nil #

def store_id=(_store_id : Store::PrimaryKeyType::Lucky::ColumnType | Nil) #

def store_query #

def updated_at : Time #

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

def weight_of_packaged_items : Float64 #

def weight_of_packaged_items=(_weight_of_packaged_items : PG::Numeric) #