Documentation ¶
Index ¶
- func FilterBy(key string) bson.M
- func FilterPatternBy(key string, value string) bson.M
- func GetAssetsPatternFilter(key string) bson.M
- func GetInsertTransaction(transaction domain.Transaction) bson.M
- func Initialize()
- func InsertUserQuery(user *domain.User) bson.M
- func IsDuplicatedWrite(err error) bool
- func MatchFilter(url string) bson.M
- func UpdateAssetQuery(asset *domain.Asset) bson.M
- func UpdateCompletionQuery(match *domain.Match) bson.M
- func UpdateMatchQuery(match *domain.Match) bson.M
- func UpdateWallet(id string, budget float64, assets []domain.WalletAssetDocument) (bson.M, bson.M)
- func UpdateWalletQuery(value float64, assets []domain.WalletAssetDocument) bson.M
- func UpsertAssets(asset *domain.Asset) (bson.M, bson.M)
- func UpsertMatch(match *domain.Match) (bson.M, bson.M)
- func UpsertMatchCompletion(match *domain.Match) (bson.M, bson.M)
- type Collection
- func (c *Collection) FindOne(filter bson.M, document interface{}) error
- func (c *Collection) Insert(document interface{}) error
- func (c *Collection) InsertWithContext(document interface{}, context context.Context) error
- func (c *Collection) Update(filter bson.M, update bson.M) error
- func (c *Collection) UpdateWithContext(filter bson.M, update bson.M, context context.Context) error
- func (c *Collection) Upsert(filter bson.M, update bson.M, document interface{}) error
- type Database
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAssetsPatternFilter ¶
func GetInsertTransaction ¶
func GetInsertTransaction(transaction domain.Transaction) bson.M
func Initialize ¶
func Initialize()
func IsDuplicatedWrite ¶
func MatchFilter ¶
func UpdateWallet ¶
func UpdateWalletQuery ¶
func UpdateWalletQuery(value float64, assets []domain.WalletAssetDocument) bson.M
Types ¶
type Collection ¶
type Collection struct {
Collection *mongo.Collection
}
func (*Collection) FindOne ¶
func (c *Collection) FindOne(filter bson.M, document interface{}) error
func (*Collection) Insert ¶
func (c *Collection) Insert(document interface{}) error
func (*Collection) InsertWithContext ¶
func (c *Collection) InsertWithContext(document interface{}, context context.Context) error
func (*Collection) UpdateWithContext ¶
type Database ¶
type Database struct { Client *mongo.Client Matches *Collection Assets *Collection Users *Collection Transactions *Collection }
Database TODO: slice of collections
func NewDBConnection ¶
func NewDBConnection() *Database
type Options ¶
type Options struct { Database string MatchesCollection string AssetsCollection string UsersCollection string TransactionsCollection string Hostname string ReplicaSet string DirectConnection bool Port int }
func DefaultConnectionOpt ¶
func DefaultConnectionOpt(configuration *configuration.Configuration) *Options
Click to show internal directories.
Click to hide internal directories.