Documentation ¶
Index ¶
- func MakeAddItemEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, ...) http.HandlerFunc
- func MakeCreateEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, ...) http.HandlerFunc
- func MakeDeleteEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, ...) http.HandlerFunc
- func MakeGetEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, ...) http.HandlerFunc
- func MakeRemoveItemEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, ...) http.HandlerFunc
- func NewGRPCServer(m Manager) pb.ManagerServer
- type Complete
- type Identifier
- type Incomplete
- type Item
- type Manager
- type Provider
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeAddItemEndpoint ¶
func MakeAddItemEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc
MakeAddItemEndpoint creates a http endpoint to add an item to an inventory object
func MakeCreateEndpoint ¶
func MakeCreateEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc
MakeCreateEndpoint creates a http endpoint to create an inventory object
func MakeDeleteEndpoint ¶
func MakeDeleteEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc
MakeDeleteEndpoint creates a http endpoint to delete an inventory object
func MakeGetEndpoint ¶
func MakeGetEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc
MakeGetEndpoint creates a http endpoint to retrieve an inventory object
func MakeRemoveItemEndpoint ¶
func MakeRemoveItemEndpoint(l *zap.Logger, m Manager, e encode.Encoder, rb rbac.Control, pubKey rsa.PublicKey) http.HandlerFunc
MakeRemoveItemEndpoint creates a http endpoint to remove an item from an inventory object
func NewGRPCServer ¶
func NewGRPCServer(m Manager) pb.ManagerServer
NewGRPCServer creates a new grpc server instance
Types ¶
type Incomplete ¶
type Incomplete interface { Provider }
Incomplete inventory object
func NewIncomplete ¶
func NewIncomplete(items []*Item) Incomplete
NewIncomplete returns a new incomplete inventory object instance
type Item ¶
type Item struct { ID string `json:"id"` Amount uint64 `json:"amount"` Subset float64 `json:"subset"` }
Item of an inventory
type Manager ¶
type Manager interface { Get(context.Context, Identifier) (Complete, error) Create(context.Context, Incomplete) (Complete, error) AddItem(context.Context, Identifier, *Item) error RemoveItem(context.Context, Identifier, *Item) error Delete(context.Context, Identifier) error }
Manager is a manager for inventory objects
func NewGRPCClient ¶
func NewGRPCClient(c *grpc.ClientConn) Manager
NewGRPCClient creates a new inventory manager with a grpc conn
func NewManager ¶
func NewManager(r Repository) Manager
NewManager creates a new manager for managing inventory objects
type Repository ¶
type Repository interface { Get(context.Context, Identifier) (Complete, error) Create(context.Context) (Complete, error) AddItem(context.Context, Identifier, *Item) error RemoveItem(context.Context, Identifier, *Item) error Delete(context.Context, Identifier) error }
Repository to store inventory information