Documentation ¶
Overview ¶
Package menu implements all business logic regarding menus and related types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.
Functions ¶
Types ¶
type Menu ¶
type Menu struct { ID string `db:"menu_id" json:"id"` Name string `db:"name" json:"name"` CardID string `db:"card_id" json:"cardID"` UserID string `db:"user_id" json:"userID"` DateCreated time.Time `db:"date_created" json:"dateCreated"` DateUpdated time.Time `db:"date_updated" json:"dateUpdated"` }
Menu is an datastructure for a Menu object.
func Create ¶
func Create(ctx context.Context, db *sqlx.DB, user auth.Claims, nm NewMenu, now time.Time) (*Menu, error)
Create adds a Menu to the database. It returns the created Menu with fields like ID and DateCreated populated..
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.