Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition byte
Condition represents a filter comparison operation between a field and a value
const ( // Equal if it should be the same Equal Condition = 1 << iota // LessThan if it should be smaller LessThan // LessThanOrEqual if it should be smaller or equal LessThanOrEqual // GreaterThan if it should be larger GreaterThan // GreaterThanOrEqual if it should be equal or greater than GreaterThanOrEqual )
type Factory ¶
type Factory interface { // NewWallet creates a new Wallet interactor NewWallet() Wallet }
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 Query ¶
Query represents a query specification for filtering sorting, paging and limiting the data requested
func NewQuery ¶
NewQuery creates a new database query spec. The name is what the storage system should use to identify the types, usually a table or collection name.
type QueryBuilder ¶
type QueryBuilder interface { Filter(property string, value interface{}) QueryBuilder Order(property string, direction Direction) }
QueryBuilder helps with query creation
type SecurityFactory ¶
type SecurityFactory interface { // NewSecurityFactory ... NewSecurityFactory() JWTSignParser }
SecurityFactory ...
type StorageFactory ¶
type StorageFactory interface { // NewWalletRepository returns a storage specific // WalletRepository implementation NewWalletRepository() WalletRepository Close() }
StorageFactory is the interface that a storage provider needs to implement so that the engine can request repository instances as it needs them
type Wallet ¶
type Wallet interface { Insert(ctx context.Context, userID, details, description, typ, currencyAbbr, currencyName, currencyType, tokenType string, balanceAmount float64, tokenVal float32, tokenAmt int64) error // Update is the update-a-wallet use-case Update(ctx context.Context, id, userID, details, description, typ, currencyAbbr, currencyName, currencyType, tokenType string, balanceAmount float64, tokenVal float32, tokenAmt int64) error // Query is the list-the-wallets use-case Query(ctx context.Context, skip uint64, take uint64) ([]domain.Wallet, error) // FindOne ... FindOne(ctx context.Context, id string) (*domain.Wallet, error) // RemoveDelete ... Remove(ctx context.Context, id string) (string, error) // ListAllWallets ... ListAllWallets(ctx context.Context, skip, take uint64) (*[]domain.Wallet, error) }
Wallet ...
type WalletRepository ¶
type WalletRepository interface { // Wallet adds a new Wallet to the datastore Insert(c context.Context, wallet domain.Wallet) error // Put adds a new Wallet to the datastore Update(c context.Context, wallet domain.Wallet, id string) error // Query returns existing wallets matching the // query provided Query(c context.Context, query *Query) []*domain.Wallet // FindOne returns ... FindOne(c context.Context, id string) (*domain.Wallet, error) // Remove ... Remove(c context.Context, id string) (string, error) // ListAllWallets ... ListAllWallets(ctx context.Context, skip uint64, take uint64) ([]domain.Wallet, error) }
WalletRepository defines the methods that any data storage provider needs to implement to get and store wallets