crud

package
v0.0.0-...-4b8b255 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePantryItem

func CreatePantryItem(
	newItem types.CreatePantryItem,
	locationID uuid.UUID,
) (db.PantryItem, error)

func CreatePantryLocation

func CreatePantryLocation(
	newLocation types.CreatePantryLocation,
	ownerID uuid.UUID,
) (db.PantryLocation, error)

func CreateRecipe

func CreateRecipe(recipe db.CreateRecipe, userID uuid.UUID) (db.ReadRecipe, error)

func CreateUser

func CreateUser(user db.CreateUser) (db.User, error)

func DeletePantryItem

func DeletePantryItem(itemID uuid.UUID) error

func DeletePantryLocation

func DeletePantryLocation(locationID uuid.UUID) error

func DeleteRecipe

func DeleteRecipe(recipeID uuid.UUID) error

func DoesUserOwnPantryItem

func DoesUserOwnPantryItem(userID uuid.UUID, pantryItemID uuid.UUID) (bool, error)

func DoesUserOwnPantryLocation

func DoesUserOwnPantryLocation(userID uuid.UUID, locationID uuid.UUID) (bool, error)

func DoesUserOwnRecipe

func DoesUserOwnRecipe(userID uuid.UUID, recipeId uuid.UUID) (bool, error)

func GetLabelCountByUser

func GetLabelCountByUser(userID uuid.UUID) (int64, error)

func GetLabelNamesByUser

func GetLabelNamesByUser(userID uuid.UUID) ([]string, error)

func GetPantryItemByID

func GetPantryItemByID(itemID uuid.UUID) (types.ReadPantryItem, error)

func GetPantryItemCountByUserID

func GetPantryItemCountByUserID(userID uuid.UUID) (int64, error)

func GetPantryItemsByUserID

func GetPantryItemsByUserID(
	userID uuid.UUID,
	offset uint,
	limit uint,
	filters PantryItemsFilters,
) ([]types.ReadPantryItem, error)

func GetPantryLocationByID

func GetPantryLocationByID(pantryID uuid.UUID) (db.PantryLocation, error)

func GetPantryLocationsByUserID

func GetPantryLocationsByUserID(userID uuid.UUID) ([]db.PantryLocation, error)

func GetRecipeById

func GetRecipeById(id uuid.UUID) (db.ReadRecipe, error)

func GetRecipesByUserID

func GetRecipesByUserID(userID uuid.UUID, offset uint, limit uint, filters RecipesFilterParams) ([]db.ReadRecipe, error)

func GetRecipesByUserIDCount

func GetRecipesByUserIDCount(userID uuid.UUID) (int64, error)

func GetUserById

func GetUserById(userID uuid.UUID) (db.User, error)

func GetUserByUsername

func GetUserByUsername(username string) (db.User, error)

func GetUserCount

func GetUserCount() (int64, error)

func UpdatePantryItem

func UpdatePantryItem(
	itemID uuid.UUID,
	update core.SelectedUpdate[types.UpdatePantryItem],
) error

func UpdatePantryLocation

func UpdatePantryLocation(
	locationID uuid.UUID,
	update core.SelectedUpdate[types.UpdatePantryLocation],
) error

func UpdateRecipe

func UpdateRecipe(recipeID uuid.UUID, recipe db.UpdateRecipe) (db.ReadRecipe, error)

func UpdateRecipeImage

func UpdateRecipeImage(recipeID uuid.UUID, imageID *uuid.UUID) error

Types

type PantryItemsFilters

type PantryItemsFilters struct {
	Name       string
	Labels     []string
	LocationId *uuid.UUID
	Expired    *bool
}

type RecipesFilterParams

type RecipesFilterParams struct {
	Title         *string
	Labels        []string
	Freezable     *bool
	MicrowaveOnly *bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL