class Good::BaseQuery
- Good::BaseQuery
- Reference
- Object
Included Modules
Direct Known Subclasses
Defined in:
Constructors
Class Method Summary
-
.any? : Bool
Returns
true
if at least one of the collection's members is truthy. - .find(id)
-
.first : T
Returns the first element in the collection.
-
.first? : T | Nil
Returns the first element in the collection.
- .last : T
- .last? : T | Nil
- .new_with_existing_query(query : Avram::QueryBuilder)
-
.none? : Bool
Returns
true
if all of the elements of the collection are falsey. - .preload_categories(records : Enumerable, preload_query)
- .preload_categories(record, preload_query)
- .preload_categories(records : Enumerable)
- .preload_categories(record)
- .preload_categories(records : Enumerable, &)
- .preload_categories(record, &)
- .preload_goods_categories(records : Enumerable, preload_query)
- .preload_goods_categories(record, preload_query)
- .preload_goods_categories(records : Enumerable)
- .preload_goods_categories(record)
- .preload_goods_categories(records : Enumerable, &)
- .preload_goods_categories(record, &)
- .preload_goods_in_stores(records : Enumerable, preload_query)
- .preload_goods_in_stores(record, preload_query)
- .preload_goods_in_stores(records : Enumerable)
- .preload_goods_in_stores(record)
- .preload_goods_in_stores(records : Enumerable, &)
- .preload_goods_in_stores(record, &)
- .preload_order_items(records : Enumerable, preload_query)
- .preload_order_items(record, preload_query)
- .preload_order_items(records : Enumerable)
- .preload_order_items(record)
- .preload_order_items(records : Enumerable, &)
- .preload_order_items(record, &)
- .preload_stores(records : Enumerable, preload_query)
- .preload_stores(record, preload_query)
- .preload_stores(records : Enumerable)
- .preload_stores(record)
- .preload_stores(records : Enumerable, &)
- .preload_stores(record, &)
- .preload_unit(records : Enumerable, preload_query)
- .preload_unit(record, preload_query)
- .preload_unit(records : Enumerable)
- .preload_unit(record)
- .preload_unit(records : Enumerable, &)
- .preload_unit(record, &)
-
.truncate(*, cascade : Bool = false)
Removes all data from a table using the TRUNCATE postgres SQL command.
Instance Method Summary
- #categories(&)
-
#clone
Returns a copy of
self
with all instance variables cloned. - #created_at(value)
- #created_at
- #description(value)
- #description
- #find(id)
- #full_join_categories
- #full_join_goods_categories
- #full_join_goods_in_stores
- #full_join_order_items
- #full_join_stores
- #full_join_unit
- #goods_categories(&)
- #goods_in_stores(&)
- #id(value)
- #id
- #inner_join_categories
- #inner_join_goods_categories
- #inner_join_goods_in_stores
- #inner_join_order_items
- #inner_join_stores
- #inner_join_unit
- #join_categories
- #join_goods_categories
- #join_goods_in_stores
- #join_order_items
- #join_stores
- #join_unit
- #left_join_categories
- #left_join_goods_categories
- #left_join_goods_in_stores
- #left_join_order_items
- #left_join_stores
- #left_join_unit
- #name(value)
- #name
- #order_items(&)
- #preload_categories(preload_query : Category::BaseQuery)
- #preload_categories
- #preload_categories(&)
- #preload_goods_categories(preload_query : GoodsCategory::BaseQuery)
- #preload_goods_categories
- #preload_goods_categories(&)
- #preload_goods_in_stores(preload_query : GoodsInStore::BaseQuery)
- #preload_goods_in_stores
- #preload_goods_in_stores(&)
- #preload_order_items(preload_query : OrderItem::BaseQuery)
- #preload_order_items
- #preload_order_items(&)
- #preload_stores(preload_query : Store::BaseQuery)
- #preload_stores
- #preload_stores(&)
- #preload_unit(preload_query : Unit::BaseQuery)
- #preload_unit
- #preload_unit(&)
- #price(value)
- #price
- #right_join_categories
- #right_join_goods_categories
- #right_join_goods_in_stores
- #right_join_order_items
- #right_join_stores
- #right_join_unit
- #stores(&)
- #unit(&)
- #unit_id(value)
- #unit_id
-
#update(id : Int32 | Avram::Nothing = Avram::Nothing.new, created_at : Time | Avram::Nothing = Avram::Nothing.new, updated_at : Time | Avram::Nothing = Avram::Nothing.new, unit_id : Unit::PrimaryKeyType | Avram::Nothing | Nil = Avram::Nothing.new, name : String | Avram::Nothing = Avram::Nothing.new, description : String | Avram::Nothing = Avram::Nothing.new, price : Float64 | Avram::Nothing = Avram::Nothing.new, weight : Float64 | Avram::Nothing = Avram::Nothing.new) : Int64
Update the records using the query's where clauses, or all records if no wheres are added.
- #updated_at(value)
- #updated_at
- #weight(value)
- #weight
- #where_categories(assoc_query : Category::BaseQuery, auto_inner_join : Bool = true)
- #where_goods_categories(assoc_query : GoodsCategory::BaseQuery, auto_inner_join : Bool = true)
- #where_goods_in_stores(assoc_query : GoodsInStore::BaseQuery, auto_inner_join : Bool = true)
- #where_order_items(assoc_query : OrderItem::BaseQuery, auto_inner_join : Bool = true)
- #where_stores(assoc_query : Store::BaseQuery, auto_inner_join : Bool = true)
- #where_unit(assoc_query : Unit::BaseQuery, auto_inner_join : Bool = true)
Macro Summary
Constructor Detail
Class Method Detail
Returns true
if at least one of the collection's members is truthy.
[nil, true, 99].any? # => true
[nil, false].any? # => false
Returns the first element in the collection. Raises Enumerable::EmptyError
if the collection is empty.
([1, 2, 3]).first # => 1
([] of Int32).first # raises Enumerable::EmptyError
Returns the first element in the collection.
When the collection is empty, returns nil
.
([1, 2, 3]).first? # => 1
([] of Int32).first? # => nil
Returns true
if all of the elements of the collection are falsey.
[nil, false].none? # => true
[nil, false, true].none? # => false
It's the opposite of all?
.
Removes all data from a table using the TRUNCATE postgres SQL command.
You should run this command with cascade: true
if your table
columns are referenced by other foreign key constraints. Use delete
instead if you don't want to accidentally delete rows referenced
elsewhere.
To delete all data referenced by foreign keys as well, set cascade to true.
Instance Method Detail
Update the records using the query's where clauses, or all records if no wheres are added.
Returns the number of records updated as Int64
.
# Update all comments with the word "spam" as spam
CommentQuery.new.body.ilike("spam").update(spam: true)