core

package
v0.0.0-...-166078d Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CartState

type CartState struct {
	Meals        []*Meal `json:"meals"`
	CartValue    float32 `json:"cart_value"`
	DeliveryCost float32 `json:"delivery_cost"`
	LobbyCount   int     `json:"lobby_count"`
}

type Lobby

type Lobby struct {
	ID         int         `json:"id" db:"id"`
	Restaurant *Restaurant `json:"restaurant,omitempty"`
	Expires    *time.Time  `json:"expires,omitempty" db:"expires"`
	Location   *Location   `json:"location,omitempty"`
}

type LobbyService

type LobbyService interface {
	List(ctx context.Context) ([]*Lobby, error)

	Create(
		ctx context.Context,
		restaurantID int,
		ownerID int,
		expires *time.Time,
		address string,
	) (*Lobby, error)

	Edit(
		ctx context.Context,
		lobbyID int,
		restaurantID int,
		ownerID int,
		expires *time.Time,
		address string,
	) (*Lobby, error)

	Join(ctx context.Context, lobbyID int, clientID int) (*Lobby, error)

	Get(ctx context.Context, userID int, lobbyID int) (*Lobby, error)

	Clean(ctx context.Context)

	BelongsToLobby(ctx context.Context, userID int, lobbyID int) (bool, error)

	AddToCart(ctx context.Context, userID int, lobbyID int, mealID int) (*CartState, error)

	DelFromCart(ctx context.Context, userID int, lobbyID int, mealID int) (*CartState, error)

	CollectCartInfo(ctx context.Context, userID int, lobbyID int) (*CartState, error)
}

type LobbyStore

type LobbyStore interface {
	List(ctx context.Context) ([]*Lobby, error)

	Create(
		ctx context.Context,
		restaurantID int,
		ownerID int,
		expires *time.Time,
		address string,
	) (*Lobby, error)

	Edit(
		ctx context.Context,
		lobbyID int,
		restaurantID int,
		ownerID int,
		expires *time.Time,
		address string,
	) (*Lobby, error)

	Join(ctx context.Context, lobbyID int, clientID int) error

	Get(ctx context.Context, lobbyID int) (*Lobby, error)

	Clean(ctx context.Context)

	BelongsToLobby(ctx context.Context, userID int, lobbyID int) (bool, error)

	AddToCart(ctx context.Context, userID int, lobbyID int, mealID int) error

	DelFromCart(ctx context.Context, userID int, lobbyID int, mealID int) error

	CollectCartInfo(ctx context.Context, userID int, lobbyID int) (*CartState, error)

	Available(ctx context.Context, id int) error
}

type Location

type Location struct {
	GeoLat  float64 `json:"lat" db:"geolat"`
	GeoLon  float64 `json:"lon" db:"geolon"`
	Address string  `json:"lobby_address" db:"address"`
}

type Meal

type Meal struct {
	ID           int     `json:"id"`
	RestaurantID int     `json:"restaurant_id,omitempty"`
	Name         string  `json:"name"`
	Price        float32 `json:"price"`
	Description  string  `json:"description,omitempty"`
}

type Restaurant

type Restaurant struct {
	ID       int     `json:"id"`
	Name     string  `json:"name"`
	Menu     []*Meal `json:"menu,omitempty"`
	Address  string  `json:"address,omitempty"`
	Delivery float32 `json:"delivery_cost"`
}

type RestaurantService

type RestaurantService interface {
	List(ctx context.Context) ([]*Restaurant, error)
	GetMenu(ctx context.Context, restaurantID int) ([]*Meal, error)
	Get(ctx context.Context, restaurantID int) (*Restaurant, error)
}

type RestaurantStore

type RestaurantStore interface {
	List(ctx context.Context) ([]*Restaurant, error)
	GetMenu(ctx context.Context, restaurantID int) ([]*Meal, error)
	Get(ctx context.Context, restaurantID int) (*Restaurant, error)
}

type User

type User struct {
	ID   int    `json:"user_id"`
	Name string `json:"user_name"`
}

type UserService

type UserService interface {
	Get(ctx context.Context, id int) (*User, error)
	List(ctx context.Context) ([]*User, error)
	Create(ctx context.Context, userName string) (*User, error)
	Login(ctx context.Context, id int) (*User, error)
}

type UserStore

type UserStore interface {
	Get(ctx context.Context, id int) (*User, error)
	List(ctx context.Context) ([]*User, error)
	Create(ctx context.Context, userName string) (*User, error)
}

Jump to

Keyboard shortcuts

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