storage

package
v0.0.0-...-e69715a Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseTypeSqlite3 = "sqlite3"
	DatabaseTypeMysql   = "mysql"
)
View Source
const (
	OrderByModeAsc  = 1
	OrderByModeDesc = 2
)
View Source
const (
	SortTypeId         = 0
	SortTypeDeployTime = 1
	SortTpyeProgress   = 2
	SortTypeHolders    = 3
	SortTypeTxCnt      = 4
)
View Source
const DBSessionLockKey = "db_session_global_lock_tx"

Variables

This section is empty.

Functions

This section is empty.

Types

type CountResult

type CountResult struct {
	Count int64 `gorm:"column:cnt"`
}

type DBClient

type DBClient struct {
	SqlDB *gorm.DB
}

func NewDbClient

func NewDbClient(cfg *config.DatabaseConfig) (*DBClient, error)

NewDbClient creates a new database client instance.

func NewMysqlClient

func NewMysqlClient(cfg *config.DatabaseConfig, gormCfg *gorm.Config) (*DBClient, error)

func NewSqliteClient

func NewSqliteClient(cfg *config.DatabaseConfig, gormCfg *gorm.Config) (*DBClient, error)

func (*DBClient) AddChainStatHour

func (conn *DBClient) AddChainStatHour(chainStatHour *model.ChainStatHour) error

func (*DBClient) BatchAddAddressTx

func (conn *DBClient) BatchAddAddressTx(dbTx *gorm.DB, items []*model.AddressTxs) error

func (*DBClient) BatchAddBalanceTx

func (conn *DBClient) BatchAddBalanceTx(dbTx *gorm.DB, items []*model.BalanceTxn) error

func (*DBClient) BatchAddBalances

func (conn *DBClient) BatchAddBalances(dbTx *gorm.DB, items []*model.Balances) error

func (*DBClient) BatchAddInscription

func (conn *DBClient) BatchAddInscription(dbTx *gorm.DB, ins []*model.Inscriptions) error

func (*DBClient) BatchAddInscriptionStats

func (conn *DBClient) BatchAddInscriptionStats(dbTx *gorm.DB, ins []*model.InscriptionsStats) error

func (*DBClient) BatchAddTransaction

func (conn *DBClient) BatchAddTransaction(dbTx *gorm.DB, items []*model.Transaction) error

func (*DBClient) BatchUpdateBalances

func (conn *DBClient) BatchUpdateBalances(dbTx *gorm.DB, chain string, items []*model.Balances) error

func (*DBClient) BatchUpdateInscription

func (conn *DBClient) BatchUpdateInscription(dbTx *gorm.DB, chain string, items []*model.Inscriptions) error

func (*DBClient) BatchUpdateInscriptionStats

func (conn *DBClient) BatchUpdateInscriptionStats(dbTx *gorm.DB, chain string, items []*model.InscriptionsStats) error

func (*DBClient) BatchUpdatesBySID

func (conn *DBClient) BatchUpdatesBySID(dbTx *gorm.DB, chain string, tblName string, fields map[string]string, values []map[string]interface{}) (error, int64)

func (*DBClient) CountTickByChain

func (conn *DBClient) CountTickByChain(chain string) int64

func (*DBClient) CreateInBatches

func (conn *DBClient) CreateInBatches(dbTx *gorm.DB, value interface{}, batchSize int) error

func (*DBClient) FindAddressTxByHash

func (conn *DBClient) FindAddressTxByHash(chain string, hash common.Hash) (*model.AddressTxs, error)

func (*DBClient) FindAddressTxByIdAndChainAndLimit

func (conn *DBClient) FindAddressTxByIdAndChainAndLimit(chain string, start uint64, limit int) ([]model.AddressTxs, error)

func (*DBClient) FindBalanceByTxHash

func (conn *DBClient) FindBalanceByTxHash(hash string) ([]*model.BalanceTxn, error)

func (*DBClient) FindBalanceTxByIdAndChainAndLimit

func (conn *DBClient) FindBalanceTxByIdAndChainAndLimit(chain string, balanceIndex uint64, limit int) ([]model.BalanceTxn, error)

func (*DBClient) FindInscriptionByTick

func (conn *DBClient) FindInscriptionByTick(chain, protocol, tick string) (*model.Inscriptions, error)

FindInscriptionByTick find token by tick

func (*DBClient) FindInscriptionInfo

func (conn *DBClient) FindInscriptionInfo(chain, protocol, tick, deployHash string) (*model.InscriptionOverView, error)

func (*DBClient) FindInscriptionStatsInfoByBaseId

func (conn *DBClient) FindInscriptionStatsInfoByBaseId(insId uint32) (*model.InscriptionsStats, error)

FindInscriptionStatsInfoByBaseId find inscription stats info by base id

func (*DBClient) FindInscriptionsStatsByTick

func (conn *DBClient) FindInscriptionsStatsByTick(chain string, protocol string, tick string) (*model.InscriptionsStats, error)

func (*DBClient) FindInscriptionsTxByIdAndChainAndLimit

func (conn *DBClient) FindInscriptionsTxByIdAndChainAndLimit(chain string, nowHour, lastHour time.Time) ([]model.Inscriptions, error)

func (*DBClient) FindLastBlock

func (conn *DBClient) FindLastBlock(chain string) (*model.Block, error)

func (*DBClient) FindLastChainStatHourByChainAndDateHour

func (conn *DBClient) FindLastChainStatHourByChainAndDateHour(chain string, dateHour uint32) (*model.ChainStatHour, error)

func (*DBClient) FindTransaction

func (conn *DBClient) FindTransaction(chain string, hash common.Hash) (*model.Transaction, error)

func (*DBClient) FindUserBalanceByTick

func (conn *DBClient) FindUserBalanceByTick(chain, protocol, tick, addr string) (*model.Balances, error)

func (*DBClient) GetAddressInscriptions

func (conn *DBClient) GetAddressInscriptions(limit, offset int, address, chain, protocol, tick string,
	key string, sort int) (
	[]*model.BalanceInscription, int64, error)

func (*DBClient) GetAddressTxs

func (conn *DBClient) GetAddressTxs(limit, offset int, address, chain, protocol, tick string, event int8) ([]*model.AddressTransaction, int64, error)

func (*DBClient) GetAllBlocks

func (conn *DBClient) GetAllBlocks() ([]model.Block, error)

GetAllBlocks query all last block from block table

func (*DBClient) GetAllChainFromBlock

func (conn *DBClient) GetAllChainFromBlock() ([]string, error)

GetAllChainFromBlock query all chains from block table

func (*DBClient) GetAllChainInfo

func (conn *DBClient) GetAllChainInfo() ([]model.ChainInfo, error)

func (*DBClient) GetBalancesByIdLimit

func (conn *DBClient) GetBalancesByIdLimit(chain string, start uint64, limit int) ([]model.Balances, error)

func (*DBClient) GetBalancesChainByAddress

func (conn *DBClient) GetBalancesChainByAddress(limit, offset int, address, chain, protocol, tick string) (
	[]*model.BalanceChain, int64, error)

func (*DBClient) GetChainInfoByChain

func (conn *DBClient) GetChainInfoByChain(chain string) (*model.ChainInfo, error)

func (*DBClient) GetHoldersByTick

func (conn *DBClient) GetHoldersByTick(limit, offset int, chain, protocol, tick string, sortMode int) ([]*model.Balances, int64, error)

func (*DBClient) GetInscriptionStats

func (conn *DBClient) GetInscriptionStats(chain string, start uint64, limit int) ([]model.InscriptionsStats, error)

func (*DBClient) GetInscriptionStatsByIdLimit

func (conn *DBClient) GetInscriptionStatsByIdLimit(chain string, start uint64, limit int) ([]model.InscriptionsStats, error)

func (*DBClient) GetInscriptionStatsList

func (conn *DBClient) GetInscriptionStatsList(limit int, offset int, sort int) ([]model.InscriptionsStats, int64, error)

func (*DBClient) GetInscriptions

func (conn *DBClient) GetInscriptions(limit, offset int, chain, protocol, tick, deployBy string, sort int, sortMode int) (
	[]*model.InscriptionOverView, int64, error)

func (*DBClient) GetInscriptionsByAddress

func (conn *DBClient) GetInscriptionsByAddress(limit, offset int, address string) ([]*model.Balances, error)

func (*DBClient) GetInscriptionsByChain

func (conn *DBClient) GetInscriptionsByChain(chain string, hashes []string) ([]*model.Inscriptions, error)

func (*DBClient) GetInscriptionsByIdLimit

func (conn *DBClient) GetInscriptionsByIdLimit(chain string, start uint64, limit int) ([]model.Inscriptions, error)

func (*DBClient) GetLock

func (conn *DBClient) GetLock() (ok bool, err error)

func (*DBClient) GetTransactions

func (conn *DBClient) GetTransactions(blockTime, chain string, address string, tick string, limit int, offset int, sort int) ([]*model.Transaction, int64, error)

GetTransactions find all transaction

func (*DBClient) GetTransactionsByAddress

func (conn *DBClient) GetTransactionsByAddress(limit, offset int, address, chain, protocol, tick, key string, event int8) (
	[]*model.AddressTransaction, int64, error)

func (*DBClient) GetTxsByHashes

func (conn *DBClient) GetTxsByHashes(chain string, hashes []common.Hash) ([]*model.Transaction, error)

func (*DBClient) GetUTXOCount

func (conn *DBClient) GetUTXOCount(address, chain, protocol, tick string) (int64, error)

func (*DBClient) GetUTXOsByIdLimit

func (conn *DBClient) GetUTXOsByIdLimit(start uint64, limit int) ([]model.UTXO, error)

func (*DBClient) GetUtxosByAddress

func (conn *DBClient) GetUtxosByAddress(address, chain, protocol, tick string) ([]*model.UTXO, error)

func (*DBClient) GroupChainBlockStat

func (conn *DBClient) GroupChainBlockStat(startTime time.Time, end time.Time, startId uint64, chain string) ([]model.ChainBlockStat, error)

func (*DBClient) GroupChainStatHour

func (conn *DBClient) GroupChainStatHour(limit, offset int, chain []string) ([]model.GroupChainStatHour, error)

func (*DBClient) GroupChainStatHourBy24Hour

func (conn *DBClient) GroupChainStatHourBy24Hour(startHour, endHour uint32, chain []string) ([]model.GroupChainStatHour, error)

func (*DBClient) MaxIdFromTransaction

func (conn *DBClient) MaxIdFromTransaction() (uint64, error)

func (*DBClient) QueryLastBlock

func (conn *DBClient) QueryLastBlock(chain string) (*big.Int, error)

func (*DBClient) ReleaseLock

func (conn *DBClient) ReleaseLock() (cnt int64, err error)

func (*DBClient) SaveLastBlock

func (conn *DBClient) SaveLastBlock(tx *gorm.DB, status *model.BlockStatus) error

func (*DBClient) UpdateInscriptionsStatsBySID

func (conn *DBClient) UpdateInscriptionsStatsBySID(dbTx *gorm.DB, chain string, id uint32, updates map[string]interface{}) error

Jump to

Keyboard shortcuts

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