Versions in this module Expand all Collapse all v0 v0.4.0 Apr 25, 2019 Changes in this version + func InitSession(session *mgo.Session) (*mgo.Session, error) + func OrderDaoDBOption(dbName string) func(dao *OrderDao) error + func PairDaoDBOption(dbName string) func(dao *PairDao) error + type AccountDao struct + func NewAccountDao() *AccountDao + func (dao *AccountDao) AddFavoriteToken(owner, token common.Address) error + func (dao *AccountDao) Create(a *types.Account) error + func (dao *AccountDao) DeleteFavoriteToken(owner, token common.Address) error + func (dao *AccountDao) Drop() + func (dao *AccountDao) FindOrCreate(addr common.Address) (*types.Account, error) + func (dao *AccountDao) GetAll() (res []types.Account, err error) + func (dao *AccountDao) GetByAddress(owner common.Address) (*types.Account, error) + func (dao *AccountDao) GetByID(id bson.ObjectId) (*types.Account, error) + func (dao *AccountDao) GetFavoriteTokens(owner common.Address) (map[common.Address]bool, error) + func (dao *AccountDao) GetTokenBalance(owner common.Address, token common.Address) (*types.TokenBalance, error) + func (dao *AccountDao) GetTokenBalances(owner common.Address) (map[common.Address]*types.TokenBalance, error) + func (dao *AccountDao) Transfer(token common.Address, fromAddress common.Address, toAddress common.Address, ...) error + func (dao *AccountDao) UpdateBalance(owner common.Address, token common.Address, balance *big.Int) error + func (dao *AccountDao) UpdateTokenBalance(owner, token common.Address, tokenBalance *types.TokenBalance) error + type AssociationDao struct + func NewAssociationDao() *AssociationDao + func (dao *AssociationDao) Drop() + func (dao *AssociationDao) GetAssociationByChainAddress(chain types.Chain, userAddress common.Address) (*types.AddressAssociationRecord, error) + func (dao *AssociationDao) GetAssociationByChainAssociatedAddress(chain types.Chain, associatedAddress common.Address) (*types.AddressAssociationRecord, error) + func (dao *AssociationDao) SaveAssociation(record *types.AddressAssociationRecord) error + func (dao *AssociationDao) SaveAssociationStatus(chain types.Chain, sourceAccount common.Address, status string) error + func (dao *AssociationDao) SaveDepositTransaction(chain types.Chain, sourceAccount common.Address, txEnvelope string) error + type ConfigDao struct + func NewConfigDao() *ConfigDao + func (dao *ConfigDao) Drop() + func (dao *ConfigDao) GetAddressIndex(chain types.Chain) (uint64, error) + func (dao *ConfigDao) GetBlockToProcess(chain types.Chain) (uint64, error) + func (dao *ConfigDao) GetSchemaVersion() uint64 + func (dao *ConfigDao) IncrementAddressIndex(chain types.Chain) error + func (dao *ConfigDao) ResetBlockCounters() error + func (dao *ConfigDao) SaveLastProcessedBlock(chain types.Chain, block uint64) error + type Database struct + Session *mgo.Session + func (d *Database) Aggregate(dbName, collection string, query []bson.M, response interface{}) error + func (d *Database) Create(dbName, collection string, data ...interface{}) (err error) + func (d *Database) DropCollection(dbName, collection string) error + func (d *Database) FindAndModify(dbName, collection string, query interface{}, change mgo.Change, ...) error + func (d *Database) Get(dbName, collection string, query interface{}, offset, limit int, ...) (err error) + func (d *Database) GetAndSort(dbName, collection string, query interface{}, sort []string, offset, limit int, ...) (err error) + func (d *Database) GetByID(dbName, collection string, id bson.ObjectId, response interface{}) (err error) + func (d *Database) GetOne(dbName, collection string, query interface{}, response interface{}) (err error) + func (d *Database) InitDatabase(session *mgo.Session) + func (d *Database) Query(dbName, collection string, query interface{}, selector interface{}, ...) (err error) + func (d *Database) Remove(dbName, collection string, query []bson.M) error + func (d *Database) RemoveAll(dbName, collection string, query interface{}) error + func (d *Database) Update(dbName, collection string, query interface{}, update interface{}) error + func (d *Database) UpdateAll(dbName, collection string, query interface{}, update interface{}) error + func (d *Database) Upsert(dbName, collection string, query interface{}, update interface{}) (interface{}, error) + type OrderDao struct + func NewOrderDao(opts ...OrderDaoOption) *OrderDao + func (dao *OrderDao) Aggregate(q []bson.M) ([]*types.OrderData, error) + func (dao *OrderDao) Create(o *types.Order) error + func (dao *OrderDao) Delete(orders ...*types.Order) error + func (dao *OrderDao) DeleteByHashes(hashes ...common.Hash) error + func (dao *OrderDao) Drop() error + func (dao *OrderDao) FindAndModify(h common.Hash, o *types.Order) (*types.Order, error) + func (dao *OrderDao) GetByHash(hash common.Hash) (*types.Order, error) + func (dao *OrderDao) GetByHashes(hashes []common.Hash) ([]*types.Order, error) + func (dao *OrderDao) GetByID(id bson.ObjectId) (*types.Order, error) + func (dao *OrderDao) GetByUserAddress(addr common.Address, limit ...int) ([]*types.Order, error) + func (dao *OrderDao) GetCurrentByUserAddress(addr common.Address, limit ...int) ([]*types.Order, error) + func (dao *OrderDao) GetHistoryByUserAddress(addr common.Address, limit ...int) ([]*types.Order, error) + func (dao *OrderDao) GetMatchingBuyOrders(o *types.Order) ([]*types.Order, error) + func (dao *OrderDao) GetMatchingSellOrders(o *types.Order) ([]*types.Order, error) + func (dao *OrderDao) GetOrderBook(p *types.Pair) ([]map[string]string, []map[string]string, error) + func (dao *OrderDao) GetOrderBookPricePoint(p *types.Pair, pp *big.Int, side string) (*big.Int, error) + func (dao *OrderDao) GetRawOrderBook(p *types.Pair) ([]*types.Order, error) + func (dao *OrderDao) GetSideOrderBook(p *types.Pair, side string, sort int, limit ...int) ([]map[string]string, error) + func (dao *OrderDao) GetUserLockedBalance(account common.Address, token common.Address, p *types.Pair) (*big.Int, error) + func (dao *OrderDao) Update(id bson.ObjectId, o *types.Order) error + func (dao *OrderDao) UpdateAllByHash(h common.Hash, o *types.Order) error + func (dao *OrderDao) UpdateByHash(h common.Hash, o *types.Order) error + func (dao *OrderDao) UpdateOrderFilledAmount(hash common.Hash, value *big.Int) error + func (dao *OrderDao) UpdateOrderFilledAmounts(hashes []common.Hash, amount []*big.Int) ([]*types.Order, error) + func (dao *OrderDao) UpdateOrderStatus(h common.Hash, status string) error + func (dao *OrderDao) UpdateOrderStatusesByHashes(status string, hashes ...common.Hash) ([]*types.Order, error) + func (dao *OrderDao) Upsert(id bson.ObjectId, o *types.Order) error + func (dao *OrderDao) UpsertByHash(h common.Hash, o *types.Order) error + type OrderDaoOption = func(*OrderDao) error + type PairDao struct + func NewPairDao(options ...PairDaoOption) *PairDao + func (dao *PairDao) Create(pair *types.Pair) error + func (dao *PairDao) GetActivePairs() ([]*types.Pair, error) + func (dao *PairDao) GetAll() ([]types.Pair, error) + func (dao *PairDao) GetByID(id bson.ObjectId) (*types.Pair, error) + func (dao *PairDao) GetByName(name string) (*types.Pair, error) + func (dao *PairDao) GetByTokenAddress(baseToken, quoteToken common.Address) (*types.Pair, error) + func (dao *PairDao) GetByTokenSymbols(baseTokenSymbol, quoteTokenSymbol string) (*types.Pair, error) + func (dao *PairDao) GetListedPairs() ([]types.Pair, error) + func (dao *PairDao) GetUnlistedPairs() ([]types.Pair, error) + type PairDaoOption = func(*PairDao) error + type PriceBoardDao struct + func NewPriceBoardDao() *PriceBoardDao + func (dao *PriceBoardDao) GetLatestQuotes() (map[string]float64, error) + type TokenDao struct + func NewTokenDao() *TokenDao + func (dao *TokenDao) Create(token *types.Token) error + func (dao *TokenDao) Drop() error + func (dao *TokenDao) GetAll() ([]types.Token, error) + func (dao *TokenDao) GetBaseTokens() ([]types.Token, error) + func (dao *TokenDao) GetByAddress(addr common.Address) (*types.Token, error) + func (dao *TokenDao) GetByID(id bson.ObjectId) (*types.Token, error) + func (dao *TokenDao) GetQuoteTokens() ([]types.Token, error) + func (dao *TokenDao) UpdateFiatPriceBySymbol(symbol string, price float64) error + type TradeDao struct + func NewTradeDao() *TradeDao + func (dao *TradeDao) Aggregate(q []bson.M) ([]*types.Tick, error) + func (dao *TradeDao) Create(trades ...*types.Trade) error + func (dao *TradeDao) Delete(trades ...*types.Trade) error + func (dao *TradeDao) DeleteByHashes(hashes ...common.Hash) error + func (dao *TradeDao) Drop() + func (dao *TradeDao) FindAndModify(h common.Hash, t *types.Trade) (*types.Trade, error) + func (dao *TradeDao) GetAll() ([]types.Trade, error) + func (dao *TradeDao) GetAllTradesByPairAddress(bt, qt common.Address) ([]*types.Trade, error) + func (dao *TradeDao) GetByHash(h common.Hash) (*types.Trade, error) + func (dao *TradeDao) GetByMakerOrderHash(h common.Hash) ([]*types.Trade, error) + func (dao *TradeDao) GetByOrderHashes(hashes []common.Hash) ([]*types.Trade, error) + func (dao *TradeDao) GetByPairName(name string) ([]*types.Trade, error) + func (dao *TradeDao) GetByTakerOrderHash(h common.Hash) ([]*types.Trade, error) + func (dao *TradeDao) GetByUserAddress(a common.Address) ([]*types.Trade, error) + func (dao *TradeDao) GetLatestTrade(bt, qt common.Address) (*types.Trade, error) + func (dao *TradeDao) GetNTradesByPairAddress(bt, qt common.Address, n int) ([]*types.Trade, error) + func (dao *TradeDao) GetSortedTrades(bt, qt common.Address, n int) ([]*types.Trade, error) + func (dao *TradeDao) GetSortedTradesByUserAddress(a common.Address, limit ...int) ([]*types.Trade, error) + func (dao *TradeDao) GetTradesByPairAddress(bt, qt common.Address, n int) ([]*types.Trade, error) + func (dao *TradeDao) Update(trade *types.Trade) error + func (dao *TradeDao) UpdateByHash(h common.Hash, t *types.Trade) error + func (dao *TradeDao) UpdateTradeStatus(h common.Hash, status string) error + func (dao *TradeDao) UpdateTradeStatuses(status string, hashes ...common.Hash) ([]*types.Trade, error) + func (dao *TradeDao) UpdateTradeStatusesByHashes(status string, hashes ...common.Hash) ([]*types.Trade, error) + func (dao *TradeDao) UpdateTradeStatusesByOrderHashes(status string, hashes ...common.Hash) ([]*types.Trade, error) + func (dao *TradeDao) Upsert(id bson.ObjectId, t *types.Trade) error + func (dao *TradeDao) UpsertByHash(h common.Hash, t *types.Trade) error + type WalletDao struct + func NewWalletDao() *WalletDao + func (dao *WalletDao) Create(wallet *types.Wallet) error + func (dao *WalletDao) GetAll() ([]types.Wallet, error) + func (dao *WalletDao) GetByAddress(a common.Address) (*types.Wallet, error) + func (dao *WalletDao) GetByID(id bson.ObjectId) (*types.Wallet, error) + func (dao *WalletDao) GetDefaultAdminWallet() (*types.Wallet, error) + func (dao *WalletDao) GetOperatorWallets() ([]*types.Wallet, error)