def self.primary_key_name : Symbol | Nil
#
class Good
- Good
- BaseModel
- Avram::Model
- Reference
- Object
Included Modules
- Avram::PrimaryKeyMethods
- DB::Mappable
Defined in:
models/good.crConstant Summary
-
ASSOCIATIONS =
[{type: GoodsCategory, assoc_name: goods_categories, foreign_key: :good_id, relationship_type: :has_many, through: nil}, {type: Category, assoc_name: categories, foreign_key: :good_id, relationship_type: :has_many, through: [:goods_categories, :category]}, {type: OrderItem, assoc_name: order_items, foreign_key: :good_id, relationship_type: :has_many, through: nil}, {type: GoodsInStore, assoc_name: goods_in_stores, foreign_key: :good_id, relationship_type: :has_many, through: nil}, {type: Store, assoc_name: stores, foreign_key: :good_id, relationship_type: :has_many, through: [:goods_in_stores, :store]}, {type: Unit, assoc_name: unit, foreign_key: :unit_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: unit_id, type: Unit::PrimaryKeyType, nilable: true, autogenerated: false, value: nil, serialized: false}, {name: name, type: String, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: description, type: String, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: price, type: Float64, nilable: false, autogenerated: false, value: nil, serialized: false}, {name: weight, type: Float64, nilable: false, autogenerated: false, value: nil, serialized: false}] of Nil
-
PRIMARY_KEY_NAME =
:id
-
PRIMARY_KEY_TYPE =
Int32
Constructors
- .new(id : Int32, created_at : Time, updated_at : Time, unit_id : Int32 | Nil, name : String, description : String, price : PG::Numeric, weight : PG::Numeric)
- .new(__temp_135 : DB::ResultSet)
Class Method Summary
- .column_names : Array(Symbol)
- .columns : Array(NamedTuple(name: Symbol, nilable: Bool, type: String))
- .ensure_correct_column_mappings!
- .from_rs(__temp_135 : DB::ResultSet)
- .primary_key_name : Symbol | Nil
- .schema_enforcer_validations
- .table_name : String
Instance Method Summary
- #_preloaded_categories=(_preloaded_categories : Nil | Array(Category))
- #_preloaded_goods_categories=(_preloaded_goods_categories : Nil | Array(GoodsCategory))
- #_preloaded_goods_in_stores=(_preloaded_goods_in_stores : Nil | Array(GoodsInStore))
- #_preloaded_order_items=(_preloaded_order_items : Nil | Array(OrderItem))
- #_preloaded_stores=(_preloaded_stores : Nil | Array(Store))
-
#base_query_class : ::Good::BaseQuery.class
This makes it easy for plugins and extensions to use the base SaveOperation
- #categories : Array(Category)
- #categories! : Array(Category)
- #categories_count : Int64
- #categories_query
- #created_at : Time
- #created_at=(_created_at : Time::Lucky::ColumnType)
- #delete_operation_class : ::Good::DeleteOperation.class
- #description : String
- #description=(_description : String::Lucky::ColumnType)
- #goods_categories : Array(GoodsCategory)
- #goods_categories! : Array(GoodsCategory)
- #goods_categories_count : Int64
- #goods_categories_query
- #goods_in_stores : Array(GoodsInStore)
- #goods_in_stores! : Array(GoodsInStore)
- #goods_in_stores_count : Int64
- #goods_in_stores_query
- #id : Int32
- #id=(_id : Int32::Lucky::ColumnType)
- #name : String
- #name=(_name : String::Lucky::ColumnType)
- #order_items : Array(OrderItem)
- #order_items! : Array(OrderItem)
- #order_items_count : Int64
- #order_items_query
- #price : Float64
- #price=(_price : PG::Numeric)
- #save_operation_class : ::Good::SaveOperation.class
- #stores : Array(Store)
- #stores! : Array(Store)
- #stores_count : Int64
- #stores_query
- #unit : Unit | Nil
- #unit! : Unit | Nil
- #unit_count : Int64
- #unit_id : Unit::PrimaryKeyType | Nil
- #unit_id=(_unit_id : Unit::PrimaryKeyType::Lucky::ColumnType | Nil)
- #unit_query
- #updated_at : Time
- #updated_at=(_updated_at : Time::Lucky::ColumnType)
- #weight : Float64
- #weight=(_weight : PG::Numeric)
Class methods inherited from class BaseModel
database : Avram::Database.class
database
Constructor Detail
def self.new(id : Int32, created_at : Time, updated_at : Time, unit_id : Int32 | Nil, name : String, description : String, price : PG::Numeric, weight : PG::Numeric)
#
Class Method Detail
Instance Method Detail
This makes it easy for plugins and extensions to use the base SaveOperation