db

package
v0.0.0-...-bc159d5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoClient

func NewMongoClient() (*mongo.Client, *mongo.Database, error)

func NewPostgresClient

func NewPostgresClient(config *config.Config) (*gorm.DB, error)

func UpdateLastEventCheckPoint

func UpdateLastEventCheckPoint(db *gorm.DB, value *models.EventCheckPoint) error

Types

type DatabaseAdapter

type DatabaseAdapter struct {
	PostgresClient *gorm.DB
}

func NewDatabaseAdapter

func NewDatabaseAdapter(config *config.Config) (*DatabaseAdapter, error)

func (*DatabaseAdapter) CreateBatchValue

func (db *DatabaseAdapter) CreateBatchValue(values interface{}, batchSize int) error

func (*DatabaseAdapter) CreateRelayDatas

func (db *DatabaseAdapter) CreateRelayDatas(datas []models.RelayData, lastCheckpoint *models.EventCheckPoint) error

func (*DatabaseAdapter) CreateSingleValue

func (db *DatabaseAdapter) CreateSingleValue(value interface{}) error

func (*DatabaseAdapter) FindPayloadByHash

func (db *DatabaseAdapter) FindPayloadByHash(payloadHash string) ([]byte, error)

func (*DatabaseAdapter) FindProtocolInfo

func (db *DatabaseAdapter) FindProtocolInfo(chainName string, contractAddress string) (*models.ProtocolInfo, error)

func (*DatabaseAdapter) FindRelayDataById

func (db *DatabaseAdapter) FindRelayDataById(id string, option *QueryOptions) (*models.RelayData, error)

func (*DatabaseAdapter) GetLastEventCheckPoint

func (db *DatabaseAdapter) GetLastEventCheckPoint(chainName string) (*models.EventCheckPoint, error)

func (*DatabaseAdapter) UpdateContractCallApproved

func (db *DatabaseAdapter) UpdateContractCallApproved(messageID string, executeHash string) error

func (*DatabaseAdapter) UpdateEventStatus

func (db *DatabaseAdapter) UpdateEventStatus(id string, status RelayDataStatus) error

func (*DatabaseAdapter) UpdateRelayDataStatueWithExecuteHash

func (db *DatabaseAdapter) UpdateRelayDataStatueWithExecuteHash(id string, status RelayDataStatus, executeHash *string) error

func (*DatabaseAdapter) UpdateRelayDataStatueWithPacketSequence

func (db *DatabaseAdapter) UpdateRelayDataStatueWithPacketSequence(id string, status RelayDataStatus, sequence *int) error

--- For Setup and Run Evm and Cosmos Relayer ---

type QueryOptions

type QueryOptions struct {
	IncludeCallContract          *bool
	IncludeCallContractWithToken *bool
}

type RelayDataStatus

type RelayDataStatus int
const (
	PENDING RelayDataStatus = iota
	APPROVED
	SUCCESS
	FAILED
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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