dao

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsVoteExist added in v0.0.7

func IsVoteExist(dbTx *gorm.DB, channelId uint8, sequence uint64, pubKey string) (bool, error)

func SaveVote added in v0.0.7

func SaveVote(dbTx *gorm.DB, vote *model.Vote) error

func UpdateBatchPackagesStatus added in v0.0.7

func UpdateBatchPackagesStatus(dbTx *gorm.DB, txIds []int64, status db.TxStatus) error

func UpdateTransactionStatus added in v0.0.7

func UpdateTransactionStatus(dbTx *gorm.DB, id int64, status db.TxStatus) error

Types

type BSCDao

type BSCDao struct {
	DB *gorm.DB
}

func NewBSCDao

func NewBSCDao(db *gorm.DB) *BSCDao

func (*BSCDao) DeleteBlockAndPackagesAndVotesAtHeight added in v1.1.0

func (d *BSCDao) DeleteBlockAndPackagesAndVotesAtHeight(height uint64) error

func (*BSCDao) DeleteBlocksBelowHeight added in v0.2.4

func (d *BSCDao) DeleteBlocksBelowHeight(threshHold int64) error

func (*BSCDao) DeletePackagesBelowHeightWithLimit added in v0.2.4

func (d *BSCDao) DeletePackagesBelowHeightWithLimit(threshHold int64, limit int) error

func (*BSCDao) ExistsUnprocessedPackage added in v0.2.4

func (d *BSCDao) ExistsUnprocessedPackage(threshHold int64) (bool, error)

func (*BSCDao) GetLatestBlock

func (d *BSCDao) GetLatestBlock() (*model.BscBlock, error)

func (*BSCDao) GetLatestOracleSequenceByStatus added in v0.0.4

func (d *BSCDao) GetLatestOracleSequenceByStatus(status db.TxStatus) (int64, error)

func (*BSCDao) GetLeastSavedPackagesHeight

func (d *BSCDao) GetLeastSavedPackagesHeight() (uint64, error)

func (*BSCDao) GetPackagesByHeightAndStatus added in v0.0.7

func (d *BSCDao) GetPackagesByHeightAndStatus(status db.TxStatus, height uint64) ([]*model.BscRelayPackage, error)

func (*BSCDao) GetPackagesByOracleSequence added in v0.0.4

func (d *BSCDao) GetPackagesByOracleSequence(sequence uint64) ([]*model.BscRelayPackage, error)

func (*BSCDao) GetPackagesByStatus

func (d *BSCDao) GetPackagesByStatus(status db.TxStatus) ([]*model.BscRelayPackage, error)

func (*BSCDao) SaveBatchPackages

func (d *BSCDao) SaveBatchPackages(pkgs []*model.BscRelayPackage) error

func (*BSCDao) SaveBlockAndBatchPackages

func (d *BSCDao) SaveBlockAndBatchPackages(b *model.BscBlock, pkgs []*model.BscRelayPackage) error

func (*BSCDao) UpdateBatchPackagesClaimedTxHash added in v0.0.3

func (d *BSCDao) UpdateBatchPackagesClaimedTxHash(txIds []int64, claimTxHash string) error

func (*BSCDao) UpdateBatchPackagesStatus

func (d *BSCDao) UpdateBatchPackagesStatus(txIds []int64, status db.TxStatus) error

func (*BSCDao) UpdateBatchPackagesStatusAndClaimedTxHash

func (d *BSCDao) UpdateBatchPackagesStatusAndClaimedTxHash(txIds []int64, status db.TxStatus, claimTxHash string) error

func (*BSCDao) UpdateBatchPackagesStatusToDelivered added in v0.0.4

func (d *BSCDao) UpdateBatchPackagesStatusToDelivered(seq uint64) error

type DaoManager

type DaoManager struct {
	GreenfieldDao *GreenfieldDao
	VoteDao       *VoteDao
	BSCDao        *BSCDao
}

func NewDaoManager

func NewDaoManager(greenfieldDao *GreenfieldDao, bscDao *BSCDao, voteDao *VoteDao) *DaoManager

type GreenfieldDao

type GreenfieldDao struct {
	DB *gorm.DB
}

func NewGreenfieldDao

func NewGreenfieldDao(db *gorm.DB) *GreenfieldDao

func (*GreenfieldDao) DeleteBlocksBelowHeight added in v0.2.4

func (d *GreenfieldDao) DeleteBlocksBelowHeight(threshHold int64) error

func (*GreenfieldDao) DeleteTransactionsBelowHeightWithLimit added in v0.2.4

func (d *GreenfieldDao) DeleteTransactionsBelowHeightWithLimit(threshHold int64, limit int) error

func (*GreenfieldDao) ExistsUnprocessedTransaction added in v0.2.4

func (d *GreenfieldDao) ExistsUnprocessedTransaction(threshHold int64) (bool, error)

func (*GreenfieldDao) GetLatestBlock

func (d *GreenfieldDao) GetLatestBlock() (*model.GreenfieldBlock, error)

func (*GreenfieldDao) GetLatestSequenceByChannelIdAndStatus added in v0.0.4

func (d *GreenfieldDao) GetLatestSequenceByChannelIdAndStatus(channelId types.ChannelId, status db.TxStatus) (int64, error)

func (*GreenfieldDao) GetLatestSyncedTransaction added in v0.0.7

func (d *GreenfieldDao) GetLatestSyncedTransaction() (*model.SyncLightBlockTransaction, error)

func (*GreenfieldDao) GetLeastSavedTransactionHeight

func (d *GreenfieldDao) GetLeastSavedTransactionHeight() (uint64, error)

func (*GreenfieldDao) GetTransactionByChannelIdAndSequence added in v0.0.4

func (d *GreenfieldDao) GetTransactionByChannelIdAndSequence(channelId types.ChannelId, sequence uint64) (*model.GreenfieldRelayTransaction, error)

func (*GreenfieldDao) GetTransactionsByStatusWithLimit added in v0.0.7

func (d *GreenfieldDao) GetTransactionsByStatusWithLimit(s db.TxStatus, limit int64) ([]*model.GreenfieldRelayTransaction, error)

func (*GreenfieldDao) SaveBlockAndBatchTransactions

func (d *GreenfieldDao) SaveBlockAndBatchTransactions(b *model.GreenfieldBlock, txs []*model.GreenfieldRelayTransaction) error

func (*GreenfieldDao) SaveSyncLightBlockTransaction added in v0.0.3

func (d *GreenfieldDao) SaveSyncLightBlockTransaction(t *model.SyncLightBlockTransaction) error

func (*GreenfieldDao) UpdateBatchTransactionStatusToDelivered added in v0.0.4

func (d *GreenfieldDao) UpdateBatchTransactionStatusToDelivered(seq uint64) error

func (*GreenfieldDao) UpdateTransactionClaimedTxHash added in v0.0.3

func (d *GreenfieldDao) UpdateTransactionClaimedTxHash(id int64, claimedTxHash string) error

func (*GreenfieldDao) UpdateTransactionStatus

func (d *GreenfieldDao) UpdateTransactionStatus(id int64, status db.TxStatus) error

func (*GreenfieldDao) UpdateTransactionStatusAndClaimedTxHash

func (d *GreenfieldDao) UpdateTransactionStatusAndClaimedTxHash(id int64, status db.TxStatus, claimedTxHash string) error

type VoteDao

type VoteDao struct {
	DB *gorm.DB
}

func NewVoteDao

func NewVoteDao(db *gorm.DB) *VoteDao

func (*VoteDao) DeleteVotesBelowHeightWithLimit added in v0.2.4

func (d *VoteDao) DeleteVotesBelowHeightWithLimit(threshHold int64, eventType uint32, limit int) error

func (*VoteDao) GetVoteByChannelIdAndSequenceAndPubKey

func (d *VoteDao) GetVoteByChannelIdAndSequenceAndPubKey(channelId uint8, sequence uint64, pubKey string) (*model.Vote, error)

func (*VoteDao) GetVotesByChannelIdAndSequence

func (d *VoteDao) GetVotesByChannelIdAndSequence(channelId uint8, sequence uint64) ([]*model.Vote, error)

func (*VoteDao) GetVotesCountByChannelIdAndSequence added in v0.0.4

func (d *VoteDao) GetVotesCountByChannelIdAndSequence(channelId uint8, sequence uint64) (int64, error)

func (*VoteDao) IsVoteExist

func (d *VoteDao) IsVoteExist(channelId uint8, sequence uint64, pubKey string) (bool, error)

func (*VoteDao) SaveBatchVotes

func (d *VoteDao) SaveBatchVotes(votes []*model.Vote) error

func (*VoteDao) SaveVote

func (d *VoteDao) SaveVote(vote *model.Vote) error

Jump to

Keyboard shortcuts

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