MenuItem item_id
item_name
item_price
item_type <------- Can be "veg" or "non-veg"
Currently, I am fetching all the categories for a particular restaurant like this:
CoreStoreDefaults.dataStack.fetchAll(
From()
.where(format:"%K = %@", #keyPath(MenuCategory.restaurant_id), restaurant_id)
.orderBy(.ascending(.category_id))
)
And accessing subCategories by category?[section].sub_categories
and accessing items category?[section].items
How to fetch all categories where all items or sub_categories items are "veg"?
Originally created by @techiesanjaypathak on GitHub (Jun 11, 2020).
My restaurant table structure is as follows:
**MenuCategory**
_restaurant_id
category_id
category_name
items
sub_categories_
Either items or sub_categories will be present in the above table.
**MenuSubCategory**
_ranking
sub_category_id
sub_caterory_name_
**MenuItem**
_item_id
item_name
item_price
item_type_ <------- Can be "veg" or "non-veg"
Currently, I am fetching all the categories for a particular restaurant like this:
CoreStoreDefaults.dataStack.fetchAll(
From<MenuCategory>()
.where(format:"%K = %@", #keyPath(MenuCategory.restaurant_id), restaurant_id)
.orderBy(.ascending(\.category_id))
)
And accessing subCategories by category?[section].sub_categories
and accessing items category?[section].items
How to fetch all categories where all items or sub_categories items are "veg"?
There is no built-in syntax in CoreStore for this yet, but you can use SUBQUERY expressions in the where() clause
@JohnEstropia commented on GitHub (Jun 12, 2020):
There is no built-in syntax in CoreStore for this yet, but you can use SUBQUERY expressions in the `where()` clause
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @techiesanjaypathak on GitHub (Jun 11, 2020).
My restaurant table structure is as follows:
MenuCategory
restaurant_id
category_id
category_name
items
sub_categories
MenuSubCategory
ranking
sub_category_id
sub_caterory_name
MenuItem
item_id
item_name
item_price
item_type <------- Can be "veg" or "non-veg"
Currently, I am fetching all the categories for a particular restaurant like this:
CoreStoreDefaults.dataStack.fetchAll(
From()
.where(format:"%K = %@", #keyPath(MenuCategory.restaurant_id), restaurant_id)
.orderBy(.ascending(.category_id))
)
And accessing subCategories by category?[section].sub_categories
and accessing items category?[section].items
How to fetch all categories where all items or sub_categories items are "veg"?
@JohnEstropia commented on GitHub (Jun 12, 2020):
There is no built-in syntax in CoreStore for this yet, but you can use SUBQUERY expressions in the
where()clause