Package menu implements all business logic regarding menus and related types.
- func Delete(ctx context.Context, db *sqlx.DB, id string) error
- func Update(ctx context.Context, db *sqlx.DB, user auth.Claims, id string, ...) error
- type Menu
- type NewMenu
- type UpdateMenu
This section is empty.
var ( // ErrNotFound is used when a specific Menu is requested but does not exist. ErrNotFound = errors.New("menu not found") // ErrInvalidID is used when an invalid UUID is provided. ErrInvalidID = errors.New("ID is not in its proper form") // ErrForbidden occurs when a user tries to do something that is forbidden to // them according to our access control policies. ErrForbidden = errors.New("Attempted action is not allowed") )
Predefined errors identify expected failure conditions.
Delete removes the menu identified by a given ID.
Menu is an datastructure for a Menu object.
Create adds a Menu to the database. It returns the created Menu with fields like ID and DateCreated populated..
List gets all Menus from the database.
NewMenu is what we require from admin when adding a Menu.
type UpdateMenu ¶
UpdateMenu defines what information may be provided to modify an existing Menu. All fields are optional so clients can send just the fields they want changed. It uses pointer fields so we can differentiate between a field that was not provided and a field that was provided as explicitly blank. Normally we do not want to use pointers to basic types but we make exceptions around marshalling/unmarshalling.