Documentation ¶
Index ¶
Constants ¶
View Source
const ( StatusFailed = iota StatusPending StatusExecuted StatusPacked StatusCommitted StatusVerified )
View Source
const (
PoolTxTableName = `pool_tx`
)
View Source
const TxDetailTableName = `tx_detail`
View Source
const (
TxTableName = `tx`
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetTxOptionFunc ¶ added in v0.0.5
type GetTxOptionFunc func(*getTxOption)
func GetTxWithDeleted ¶ added in v0.0.5
func GetTxWithDeleted() GetTxOptionFunc
func GetTxWithFromHash ¶ added in v0.0.5
func GetTxWithFromHash(hash string) GetTxOptionFunc
func GetTxWithStatuses ¶ added in v0.0.5
func GetTxWithStatuses(statuses []int64) GetTxOptionFunc
func GetTxWithTypes ¶ added in v0.0.5
func GetTxWithTypes(txTypes []int64) GetTxOptionFunc
type Tx ¶
type Tx struct { gorm.Model // Assigned when created in the tx pool. TxHash string `gorm:"uniqueIndex"` TxType int64 TxInfo string AccountIndex int64 Nonce int64 ExpiredAt int64 // Assigned after executed. GasFee string GasFeeAssetId int64 NftIndex int64 CollectionId int64 AssetId int64 TxAmount string Memo string ExtraInfo string NativeAddress string // a. Priority tx, assigned when created b. Other tx, assigned after executed. TxDetails []*TxDetail `gorm:"foreignKey:TxId"` TxIndex int64 BlockHeight int64 `gorm:"index"` BlockId int64 `gorm:"index"` TxStatus int `gorm:"index"` }
type TxDetail ¶
type TxDetailModel ¶
func NewTxDetailModel ¶
func NewTxDetailModel(db *gorm.DB) TxDetailModel
type TxModel ¶
type TxModel interface { CreateTxTable() error DropTxTable() error GetTxsTotalCount(options ...GetTxOptionFunc) (count int64, err error) GetTxs(limit int64, offset int64, options ...GetTxOptionFunc) (txList []*Tx, err error) GetTxsByAccountIndex(accountIndex int64, limit int64, offset int64, options ...GetTxOptionFunc) (txList []*Tx, err error) GetTxsCountByAccountIndex(accountIndex int64, options ...GetTxOptionFunc) (count int64, err error) GetTxByHash(txHash string) (tx *Tx, err error) GetTxsTotalCountBetween(from, to time.Time) (count int64, err error) GetDistinctAccountsCountBetween(from, to time.Time) (count int64, err error) UpdateTxsStatusInTransact(tx *gorm.DB, blockTxStatus map[int64]int) error }
func NewTxModel ¶
type TxPoolModel ¶
type TxPoolModel interface { CreatePoolTxTable() error DropPoolTxTable() error GetTxs(limit int64, offset int64, options ...GetTxOptionFunc) (txs []*Tx, err error) GetTxsTotalCount(options ...GetTxOptionFunc) (count int64, err error) GetTxByTxHash(hash string) (txs *Tx, err error) GetTxsByStatus(status int) (txs []*Tx, err error) CreateTxs(txs []*Tx) error GetPendingTxsByAccountIndex(accountIndex int64, options ...GetTxOptionFunc) (txs []*Tx, err error) GetMaxNonceByAccountIndex(accountIndex int64) (nonce int64, err error) CreateTxsInTransact(tx *gorm.DB, txs []*Tx) error UpdateTxsInTransact(tx *gorm.DB, txs []*Tx) error DeleteTxsInTransact(tx *gorm.DB, txs []*Tx) error GetLatestTx(txTypes []int64, statuses []int) (tx *Tx, err error) }
func NewTxPoolModel ¶
func NewTxPoolModel(db *gorm.DB) TxPoolModel
Click to show internal directories.
Click to hide internal directories.