Documentation
¶
Index ¶
- Constants
- type Database
- type GormDB
- func (g *GormDB) AddOrder(ctx context.Context, o *model.Order) error
- func (g *GormDB) GetItemByName(ctx context.Context, name string) (*model.Item, error)
- func (g *GormDB) GetItemBySKU(ctx context.Context, sku string) (*model.Item, error)
- func (g *GormDB) GetItemsBySKU(ctx context.Context, skus []string) ([]*model.Item, error)
- func (g *GormDB) GetOrders(ctx context.Context) ([]*model.Order, error)
- func (g *GormDB) Ping(ctx context.Context) error
- func (g *GormDB) UpsertItems(ctx context.Context, items []*model.Item) ([]*model.Item, error)
- type HealthChecker
- type InventoryStore
- type OrderStore
Constants ¶
View Source
const DBName = "checkout"
View Source
const InMemoryDSN = ":memory:"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface {
HealthChecker
InventoryStore
OrderStore
}
type GormDB ¶
type GormDB struct {
// contains filtered or unexported fields
}
func NewPostgresDB ¶
NewPostgresDB returns a new GormDB with PostgreSQL engine.
func NewSQLiteDB ¶
NewSQLiteDB returns a new GormDB with SQLite engine.
func (*GormDB) GetItemByName ¶
func (*GormDB) GetItemBySKU ¶
func (*GormDB) GetItemsBySKU ¶
type HealthChecker ¶
type InventoryStore ¶
type InventoryStore interface {
UpsertItems(ctx context.Context, items []*model.Item) ([]*model.Item, error)
GetItemByName(ctx context.Context, name string) (*model.Item, error)
GetItemBySKU(ctx context.Context, sku string) (*model.Item, error)
GetItemsBySKU(ctx context.Context, sku []string) ([]*model.Item, error)
}
Click to show internal directories.
Click to hide internal directories.