orm

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2021 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

nolint

Variables

This section is empty.

Functions

func DeleteDB

func DeleteDB(dbPath string)

DeleteDB remove the sqlite db

Types

type DealDataSource

type DealDataSource struct {
	// contains filtered or unexported fields
}

nolint

type IKline1MDataSource

type IKline1MDataSource interface {
	// contains filtered or unexported methods
}

nolint

type MergeResultDataSource

type MergeResultDataSource struct {
	Orm *ORM
}

nolint

type ORM

type ORM struct {
	// contains filtered or unexported fields
}

ORM is designed for deal with database by orm http://gorm.io/docs/query.html

func MockSqlite3ORM

func MockSqlite3ORM() (*ORM, string)

MockSqlite3ORM create sqlite db for test, return orm

func New

func New(enableLog bool, engineInfo *OrmEngineInfo, logger *log.Logger) (m *ORM, err error)

New return pointer to ORM to deal with database,called at NewKeeper

func NewSqlite3ORM

func NewSqlite3ORM(enableLog bool, baseDir string, dbName string, logger *log.Logger) (orm *ORM, e error)

NewSqlite3ORM create sqlite db, return orm

func (*ORM) AddClaimInfo

func (orm *ORM) AddClaimInfo(claimInfos []*types.ClaimInfo) (addedCnt int, err error)

AddClaimInfo insert farm claimed coins into db

func (*ORM) AddDeals

func (orm *ORM) AddDeals(deals []*types.Deal) (addedCnt int, err error)

nolint

func (*ORM) AddFeeDetails

func (orm *ORM) AddFeeDetails(feeDetails []*token.FeeDetail) (addedCnt int, err error)

AddFeeDetails insert into fees

func (*ORM) AddMatchResults

func (orm *ORM) AddMatchResults(results []*types.MatchResult) (addedCnt int, err error)

nolint

func (*ORM) AddOrders

func (orm *ORM) AddOrders(orders []*types.Order) (addedCnt int, err error)

AddOrders insert into orders

func (*ORM) AddSwapInfo

func (orm *ORM) AddSwapInfo(swapInfos []*types.SwapInfo) (addedCnt int, err error)

AddSwapInfo insert into swap token pairs details

func (*ORM) AddSwapWhitelist

func (orm *ORM) AddSwapWhitelist(swapWhitelists []*types.SwapWhitelist) (addedCnt int, err error)

AddSwapWhitelist insert swap whitelist to db

func (*ORM) AddTransactions

func (orm *ORM) AddTransactions(transactions []*types.Transaction) (addedCnt int, err error)

AddTransactions insert into transactions, return count

func (*ORM) BatchInsertOrUpdate

func (orm *ORM) BatchInsertOrUpdate(newOrders []*types.Order, updatedOrders []*types.Order, deals []*types.Deal, mrs []*types.MatchResult,
	feeDetails []*token.FeeDetail, trxs []*types.Transaction, swapInfos []*types.SwapInfo, claimInfos []*types.ClaimInfo) (resultMap map[string]int, err error)

BatchInsertOrUpdate return map mean success or fail

func (*ORM) Close

func (orm *ORM) Close() error

Close close the database by orm

func (*ORM) CommitKlines

func (orm *ORM) CommitKlines(klines ...[]interface{})

CommitKlines insert into klines for test

func (*ORM) CreateKline1M

func (orm *ORM) CreateKline1M(startTS, endTS int64, dataSource IKline1MDataSource) (
	anchorEndTS int64, newProductCnt int, newKlineInfo map[string][]types.KlineM1, err error)

CreateKline1M batch insert into Kline1M

func (*ORM) Debug

func (orm *ORM) Debug(msg string)

Debug log debug info when use orm

func (*ORM) DeleteKlineBefore

func (orm *ORM) DeleteKlineBefore(unixTS int64, kline interface{}) error

DeleteKlineBefore delete from kline

func (*ORM) Error

func (orm *ORM) Error(msg string)

Error log occurred error when use orm

func (*ORM) GetAccountClaimInfos

func (orm *ORM) GetAccountClaimInfos(address string) []types.ClaimInfo

nolint

func (*ORM) GetAccountClaimedByPool

func (orm *ORM) GetAccountClaimedByPool(address string, poolName string) []types.ClaimInfo

func (*ORM) GetAccountOrders

func (orm *ORM) GetAccountOrders(address string, startTS, endTS int64, offset, limit int) ([]types.Order, int)

func (*ORM) GetDeals

func (orm *ORM) GetDeals(address, product, side string, startTime, endTime int64, offset, limit int) ([]types.Deal, int)

nolint

func (*ORM) GetDealsV2

func (orm *ORM) GetDealsV2(address, product, side string, after string, before string, limit int) []types.Deal

nolint

func (*ORM) GetDexFees

func (orm *ORM) GetDexFees(dexHandlingAddr, product string, offset, limit int) ([]types.DexFees, int)

nolint

func (*ORM) GetFeeDetails

func (orm *ORM) GetFeeDetails(address string, offset, limit int) ([]token.FeeDetail, int)

nolint

func (*ORM) GetFeeDetailsV2

func (orm *ORM) GetFeeDetailsV2(address string, after string, before string, limit int) []token.FeeDetail

nolint

func (*ORM) GetLatestKlinesByProduct

func (orm *ORM) GetLatestKlinesByProduct(product string, limit int, anchorTS int64, klines interface{}) error

nolint

func (*ORM) GetMatchResults

func (orm *ORM) GetMatchResults(product string, startTime, endTime int64,
	offset, limit int) ([]types.MatchResult, int)

nolint

func (*ORM) GetMatchResultsV2

func (orm *ORM) GetMatchResultsV2(instrumentID string, after string, before string, limit int) []types.MatchResult

nolint

func (*ORM) GetMaxBlockTimestamp

func (o *ORM) GetMaxBlockTimestamp() int64

func (*ORM) GetOrderByID

func (orm *ORM) GetOrderByID(orderID string) *types.Order

nolint

func (*ORM) GetOrderList

func (orm *ORM) GetOrderList(address, product, side string, open bool, offset, limit int,
	startTS, endTS int64, hideNoFill bool) ([]types.Order, int)

nolint

func (*ORM) GetOrderListV2

func (orm *ORM) GetOrderListV2(instrumentID string, address string, side string, open bool, after string, before string, limit int) []types.Order

nolint

func (*ORM) GetSwapInfo

func (orm *ORM) GetSwapInfo(startTime int64) []types.SwapInfo

nolint

func (*ORM) GetSwapWhitelist

func (orm *ORM) GetSwapWhitelist() []types.SwapWhitelist

nolint

func (*ORM) GetTransactionList

func (orm *ORM) GetTransactionList(address string, txType, startTime, endTime int64, offset, limit int) ([]types.Transaction, int)

nolint

func (*ORM) GetTransactionListV2

func (orm *ORM) GetTransactionListV2(address string, txType int, after string, before string, limit int) []types.Transaction

nolint

func (*ORM) MergeKlineM1

func (orm *ORM) MergeKlineM1(startTS, endTS int64, destKline types.IKline) (
	anchorEndTS int64, newKlineTypeCnt int, newKlines map[string][]interface{}, err error)

MergeKlineM1 merge KlineM1 data to KlineM*

func (*ORM) RefreshTickers

func (orm *ORM) RefreshTickers(startTS, endTS int64, productList []string) (m map[string]*types.Ticker, err error)

RefreshTickers Latest 24H KlineM1 to Ticker

func (*ORM) SetMaxBlockTimestamp

func (o *ORM) SetMaxBlockTimestamp(maxBlockTimestamp int64)

func (*ORM) UpdateOrders

func (orm *ORM) UpdateOrders(orders []*types.Order) (addedCnt int, err error)

UpdateOrders return count of orders

type OrmEngineInfo

type OrmEngineInfo = zenchaincfg.BackendOrmEngineInfo

nolint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL