class Laspatule::Repositories::DB::Ingredients
- Laspatule::Repositories::DB::Ingredients
- Reference
- Object
Included Modules
Defined in:
laspatule/repositories/db/ingredients.crConstructors
Instance Method Summary
-
#create(ingredient : Models::CreateIngredient) : Int32
Creates a new ingredient and returns its id.
-
#get_by_id(id : Int32) : Models::Ingredient
Gets an ingredient by id.
-
#search_by_name(name : String, page_size : Int32, next_page previous_page : String | Nil = nil) : Models::Page(Models::Ingredient)
Gets an ingredient by name.
Instance methods inherited from module Laspatule::Repositories::Ingredients
create(ingredient : Models::CreateIngredient) : Int32
create,
get_by_id(id : Int32) : Models::Ingredient
get_by_id,
search_by_name(name : String, page_size : Int32, next_page previous_page : String | Nil = nil) : Models::Page(Models::Ingredient)
search_by_name
Constructor Detail
Instance Method Detail
def create(ingredient : Models::CreateIngredient) : Int32
#
Description copied from module Laspatule::Repositories::Ingredients
Creates a new ingredient and returns its id.
If an ingredient with the same name already exists, raises a
DuplicatedIngredientError
.
def get_by_id(id : Int32) : Models::Ingredient
#
Description copied from module Laspatule::Repositories::Ingredients
Gets an ingredient by id.
If the ingredient is not found, raises an IngredientNotFoundError
.
def search_by_name(name : String, page_size : Int32, next_page previous_page : String | Nil = nil) : Models::Page(Models::Ingredient)
#
Description copied from module Laspatule::Repositories::Ingredients
Gets an ingredient by name.
Any ingredient containing the given name will be returned. The ingredients are ordered by the size of the name string, shortest first.
This is a paginated query, see Models::Page
for pagination instructions.