Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory interface {
// NewOrder creates a new Order interactor
NewOrder() Order
}
Factory interface allows us to provide other parts of the system with a way to make instances of our use-case / interactors when they need to
func NewEngine ¶
func NewEngine(s StorageFactory) Factory
NewEngine creates a new engine factory that will make use of the passed in StorageFactory for any data persistence needs.
type JWTSignParser ¶
type JWTSignParser interface {
Sign(claims map[string]interface{}, secret string) (map[string]interface{}, error)
Parse(tokenStr string, secret string) (map[string]interface{}, error)
}
JWTSignParser ...
type Order ¶
type Order interface {
Insert(ctx context.Context, userID, details, description, typ string, totalPrice float64, products []domain.OrderedProduct) (*domain.Order, error)
// Update is the update-a-order use-case
Update(ctx context.Context, id, userID, details, description, typ string, totalPrice float64, products []domain.OrderedProduct) error
// FindOne ...
FindOne(ctx context.Context, id string) (*domain.Order, error)
// RemoveDelete ...
Remove(ctx context.Context, id string) (string, error)
// ListAllOrders ...
ListAllOrders(ctx context.Context, skip, take uint64) (*[]domain.Order, error)
}
Order ...
type OrderRepository ¶
type OrderRepository interface {
// Order adds a new Order to the datastore
Insert(c context.Context, order domain.Order, orderProd []domain.OrderedProduct) error
// Put adds a new Order to the datastore
Update(c context.Context, order domain.Order, id string) error
// FindOne returns ...
FindOne(c context.Context, id string) (*domain.Order, error)
// Remove ...
Remove(c context.Context, id string) (string, error)
// ListAllOrders ...
ListAllOrders(ctx context.Context, skip uint64, take uint64) ([]domain.Order, error)
}
OrderRepository defines the methods that any data storage provider needs to implement to get and store orders
type SecurityFactory ¶
type SecurityFactory interface {
// NewSecurityFactory ...
NewSecurityFactory() JWTSignParser
}
SecurityFactory ...
type StorageFactory ¶
type StorageFactory interface {
// NewOrderRepository returns a storage specific
// OrderRepository implementation
NewOrderRepository() OrderRepository
Close()
}
StorageFactory is the interface that a storage provider needs to implement so that the engine can request repository instances as it needs them
Click to show internal directories.
Click to hide internal directories.