Documentation
¶
Overview ¶
Package service ...
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config is used for determing use of which services and db
func WithMenu ¶
func WithMenu() Config
WithMenu is used for calling NewMenuService with a specific db
func WithOrder ¶
func WithOrder() Config
WithOrder is used for calling NewOrderService with a specific db
func WithSqlite ¶
WithSqlite takes in a path and opens the database
type MenuDB ¶
type MenuDB interface { SeedMenu(context.Context) error CreateMenuItem(context.Context, *pb.MenuItem) (int64, error) DeleteMenuItem(context.Context, int64) error UpdateMenuItem(context.Context, *pb.MenuItem) error // CreateMenuItemOption() error GetMenu(context.Context) (*pb.Menu, error) }
MenuDB is everything that interacts with the database involving the menu
type MenuService ¶
type MenuService interface { MenuDB }
MenuService the the abstraction for the MenuDB
func NewMenuService ¶
func NewMenuService(db *sql.DB) (MenuService, error)
NewMenuService creates a menu service for interacting with the database
type OrderDB ¶
type OrderDB interface { GetOrders(context.Context) ([]*pb.Order, error) CompleteOrder(context.Context, int64) error SubmitOrder(context.Context, *pb.Order) error }
OrderDB is everything that interacts with the database involving the orders
type OrderService ¶
type OrderService interface { OrderDB }
OrderService is the abstraction of the db layer
func NewOrderService ¶
func NewOrderService(db *sql.DB) (OrderService, error)
NewOrderService creates a new order service for interacting with the database
type Services ¶
type Services struct { Order OrderService Menu MenuService // contains filtered or unexported fields }
Services is the implementation of both the Menu and Order service for interacting with the database as well as the databse itself
func NewServices ¶
NewServices creates a Service struct with all of the ServiceConfigs passed into it