Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CartStore ¶
type CartStore interface { AddProduct(userID string, prodID uint, quantity uint) (uint, error) GetProductsForUser(userID string) (map[uint]uint, error) ClearCartFor(userID string) error }
CartStore represents the shopping cart store
func New ¶
func New(log logger, db UnderlyingStore) CartStore
New start a new instance of cart store
type ShoppingCartTable ¶
type ShoppingCartTable struct {
// contains filtered or unexported fields
}
ShoppingCartTable the shopping cart table schema
func GetTable ¶
func GetTable() *ShoppingCartTable
func (*ShoppingCartTable) GetName ¶
func (u *ShoppingCartTable) GetName() string
GetName returns the name of the shopping cart table
func (*ShoppingCartTable) GetTableSchema ¶
func (u *ShoppingCartTable) GetTableSchema() *memdb.TableSchema
GetTableSchema returns the schema of the shopping cart table
type UnderlyingStore ¶
type UnderlyingStore interface { Read(table string, key string, value interface{}) (interface{}, error) Write(table string, objs ...interface{}) error Remove(table string, key string, value interface{}) error }
UnderlyingStore represents the interface that the DB should implement to be usable
type Validatable ¶
type Validatable interface {
Validate() error
}
Validatable is an item which has to adhere to certain convetions and knows how to check that it is correct
Click to show internal directories.
Click to hide internal directories.