Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectPostgres ¶
func IsRecordNotFound ¶
Types ¶
type DAO ¶
type DAO interface { PerpetualDAO OrderDAO MatchTransactionDAO LaunchTransactionDAO NonceDAO KVStoreDAO ForUpdate() // mark "ROW SHARE" Transaction(ctx context.Context, isReadOnly bool, body func(DAO) error) (err error) RepeatableRead(ctx context.Context, isReadOnly bool, body func(DAO) error) (err error) }
func NewFromGormDB ¶
type KVStoreDAO ¶
type KVStoreDAO interface { Get(key, category string) (*model.KVStore, error) Put(value *model.KVStore) error Del(key string) error List(category ...string) ([]*model.KVStore, error) }
func NewKVStoreDAO ¶
func NewKVStoreDAO(db *gorm.DB) KVStoreDAO
type LaunchTransactionDAO ¶
type LaunchTransactionDAO interface { FirstTx(status ...model.LaunchTransactionStatus) (*model.LaunchTransaction, error) FirstTxByUser(addr string, status ...model.LaunchTransactionStatus) (*model.LaunchTransaction, error) GetTxsByUser(addr string, blockNumber *uint64, status ...model.LaunchTransactionStatus) ([]*model.LaunchTransaction, error) GetTxByID(txID string) (*model.LaunchTransaction, error) GetTxByHash(txHash string) (*model.LaunchTransaction, error) GetTxsByNonce(user string, nonce *uint64, status ...model.LaunchTransactionStatus) ([]*model.LaunchTransaction, error) GetTxsByTime(unmatureTime time.Time, status ...model.LaunchTransactionStatus) ([]*model.LaunchTransaction, error) GetUsersWithStatus(status ...model.LaunchTransactionStatus) ([]string, error) CreateTx(tx *model.LaunchTransaction) error UpdateTx(tx *model.LaunchTransaction) error }
func NewLaunchTransactionDAO ¶
func NewLaunchTransactionDAO(db *gorm.DB) LaunchTransactionDAO
type MatchTransactionDAO ¶
type MatchTransactionDAO interface { CreateMatchTransaction(*model.MatchTransaction) error QueryMatchTransaction(poolAddress string, perpIndex int64, status []model.TransactionStatus) ([]*model.MatchTransaction, error) QueryUnconfirmedTransactions() ([]*model.MatchTransaction, error) QueryUnconfirmedTransactionsByContract(poolAddress string, perpIndex int64) (transactions []*model.MatchTransaction, err error) GetMatchTransaction(ID string) (*model.MatchTransaction, error) UpdateMatchTransaction(transaction *model.MatchTransaction) error }
type NonceDAO ¶
type NonceDAO interface { GetNextNonce(addr string) (uint64, bool) UpdateNonce(addr string, nonce *uint64) error }
func NewNonceDAO ¶
type OrderDAO ¶
type OrderDAO interface { CreateOrder(order *model.Order) error GetOrder(orderHash string) (*model.Order, error) GetPendingOrderUsers(poolAddress string, perpIndex int64, status []model.OrderStatus) ([]string, error) QueryOrder(traderAddress string, poolAddress string, perpIndex int64, status []model.OrderStatus, beforeOrderID, afterOrderID int64, limit int) ([]*model.Order, error) QueryOrderWithCreateTime(traderAddress string, poolAddress string, perpIndex int64, status []model.OrderStatus, beforeOrderID, afterOrderID int64, beginTime, endTime time.Time, limit int) ([]*model.Order, error) GetOrderByHashs(hashs []string) ([]*model.Order, error) UpdateOrder(order *model.Order) error LoadMatchOrders(matchItems []*model.MatchItem) error }
func NewOrderDAO ¶
type PerpetualDAO ¶
type PerpetualDAO interface { CreatePerpetual(*model.Perpetual) error GetPerpetualSyncedBlockNumber() (int64, error) // Query all the perpetuals // if isPublished is true, return published perpetuals only otherwise return all the perpetuals QueryPerpetuals(publishedOnly bool) ([]*model.Perpetual, error) GetPerpetualByPoolAddressAndIndex(address string, index int64, publishedOnly bool) (*model.Perpetual, error) UpdatePerpetual(*model.Perpetual) error }
func NewPerpetualDAO ¶
func NewPerpetualDAO(db *gorm.DB) PerpetualDAO
Click to show internal directories.
Click to hide internal directories.