Documentation
¶
Index ¶
- func Initialize(connectionString string) *sqlx.DB
- type MenuCategory
- type MenuItem
- func (MenuItem) Destroy(db *sqlx.DB, id uint64) error
- func (MenuItem) Find(db *sqlx.DB, id uint64) (*MenuItem, error)
- func (MenuItem) GetAll(db *sqlx.DB) (*[]MenuItem, error)
- func (MenuItem) GetByCategory(db *sqlx.DB, categoryID uint64) (*[]MenuItem, error)
- func (MenuItem) GetCategories(db *sqlx.DB) ([]string, error)
- func (menuItem *MenuItem) Insert(db *sqlx.DB) error
- func (menuItem *MenuItem) Update(db *sqlx.DB) error
- type Reservation
- func (Reservation) Destroy(db *sqlx.DB, id uint64) error
- func (Reservation) Find(db *sqlx.DB, id uint64) (*Reservation, error)
- func (Reservation) GetAll(db *sqlx.DB) (*[]Reservation, error)
- func (reservation *Reservation) GetStopTime() time.Time
- func (Reservation) GetUpcoming(db *sqlx.DB) (*[]Reservation, error)
- func (reservation *Reservation) Insert(db *sqlx.DB) error
- func (reservation *Reservation) Update(db *sqlx.DB) error
- func (reservation *Reservation) Validate(db *sqlx.DB) error
- type State
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MenuCategory ¶
type MenuCategory struct {
ID uint64 `json:"id" db:"id"`
// Name of the menu category.
// required: true
Name string `json:"name" db:"name"`
// Order of this category in categories list.
// required: true
Order uint64 `json:"order" db:"order"`
CreatedAt time.Time `json:"-" db:"created_at"`
UpdatedAt time.Time `json:"-" db:"updated_at"`
}
MenuCategory model for menu categories.
swagger:model
func (MenuCategory) Find ¶
func (MenuCategory) Find(db *sqlx.DB, id uint64) (*MenuCategory, error)
Find returns MenuItem object with specified ID.
func (MenuCategory) GetAll ¶
func (MenuCategory) GetAll(db *sqlx.DB) (*[]MenuCategory, error)
GetAll returns list menu categories sorted by order.
type MenuItem ¶
type MenuItem struct {
ID uint64 `json:"id" db:"id"`
// Name of the menu item.
// required: true
Name string `json:"name" db:"name"`
// Description of the menu item.
// required: true
Description string `json:"description" db:"description"`
// Price of the menu item in Bahrain Dinars.
// required: true
Price float32 `json:"price" db:"price"`
// Category of the menu item.
// required: true
CategoryID uint64 `json:"category_id" db:"category_id"`
// Image URL for the menu item.
// required: true
ImageURL string `json:"image_url" db:"image_url"`
// Active flag for the menu item.
// required: true
Active bool `json:"active" db:"active"`
CreatedAt time.Time `json:"-" db:"created_at"`
UpdatedAt time.Time `json:"-" db:"updated_at"`
}
MenuItem model for menu.
swagger:model
func (MenuItem) GetByCategory ¶
GetByCategory returns list of all menu items in given category.
func (MenuItem) GetCategories ¶
GetCategories returns list of unique menu categories.
type Reservation ¶
type Reservation struct {
ID uint64 `json:"id" db:"id"`
// ID of table, associated with reservation.
// required: true
TableID uint64 `json:"table_id" db:"table_id"`
// Number of people to seat for reservation.
// required: true
Guests int64 `json:"guests" db:"guests"`
// Email of the client.
// required: true
Email string `json:"email" db:"email"`
// Phone of the client.
// required: true
Phone string `json:"phone" db:"phone"`
State State `json:"state" db:"state"`
// Full Name of the client.
// required: true
FullName string `json:"full_name" db:"full_name"`
// Time of the reservation.
// required: true
Time time.Time `json:"time" db:"time"`
// Duration of the reservation.
// required: truee
Duration time.Duration `json:"duration" db:"duration"`
CreatedAt time.Time `json:"-" db:"created_at"`
UpdatedAt time.Time `json:"-" db:"updated_at"`
}
Reservation model for table reservation proccess.
swagger:model
func (Reservation) Destroy ¶
func (Reservation) Destroy(db *sqlx.DB, id uint64) error
Destroy reservation with specified ID.
func (Reservation) Find ¶
func (Reservation) Find(db *sqlx.DB, id uint64) (*Reservation, error)
Find returns Reservation's object with specified ID.
func (Reservation) GetAll ¶
func (Reservation) GetAll(db *sqlx.DB) (*[]Reservation, error)
GetAll returns list of all reservations.
func (*Reservation) GetStopTime ¶
func (reservation *Reservation) GetStopTime() time.Time
GetStopTime calculates finish time of reservations.
func (Reservation) GetUpcoming ¶
func (Reservation) GetUpcoming(db *sqlx.DB) (*[]Reservation, error)
GetUpcoming returns upcoming reservations.
func (*Reservation) Insert ¶
func (reservation *Reservation) Insert(db *sqlx.DB) error
Insert adds new reservation.
type State ¶
type State string
State is string representation of reservation state. swagger:strfmt state
type Table ¶
type Table struct {
ID uint64 `json:"id" db:"id"`
// Number of places to seat.
// required: true
Places int64 `json:"places" db:"places"`
// Description of the table.
// required: true
Description string `json:"description" db:"description"`
// Active flag for the table.
// required: true
Active bool `json:"active" db:"active"`
CreatedAt time.Time `json:"-" db:"created_at"`
UpdatedAt time.Time `json:"-" db:"updated_at"`
}
Table represents restaurant table.
swagger:parameters model