Documentation
¶
Index ¶
- Constants
- func BatchCreateCLBlocks(db *gorm.DB, indexer string, blocks []*CLBlock, height int64) error
- func BatchCreateCLStakingEvents(db *gorm.DB, indexer string, events []*CLStakingEvent, height int64) error
- func BatchCreateELBlocks(db *gorm.DB, indexer string, blocks []*ELBlock, height int64) error
- func BatchCreateELStakingEvents(db *gorm.DB, indexer string, events []*ELStakingEvent, height int64) error
- func BatchUpdateCLValidatorVotes(db *gorm.DB, indexer string, validatorVotes []*CLValidatorVote, height int64) error
- func BatchUpsertCLTotalStakes(db *gorm.DB, indexer string, stakes []*CLTotalStake, height int64) error
- func BatchUpsertELRewards(db *gorm.DB, indexer string, rewards []*ELReward, height int64) error
- func GetCLValidatorsVotes(db *gorm.DB, validators ...string) (map[string]int64, error)
- func GetIndexPointTime(db *gorm.DB, indexer string) (time.Time, error)
- func InsertCLTotalStake(db *gorm.DB, indexer string, stake *CLTotalStake) error
- func NewPostgresClient(ctx context.Context, configFile string) (*gorm.DB, error)
- func SetupIndexPoint(db *gorm.DB, indexPoint *IndexPoint) error
- func UpdateIndexPoint(db *gorm.DB, indexer string, blockHeight int64) error
- type CLBlock
- type CLStakingEvent
- type CLTotalStake
- type CLValidatorVote
- type ELBlock
- type ELReward
- type ELStakingEvent
- type IndexPoint
- type MetricsPlugin
- type Operation
- type PostgresConfig
Constants ¶
View Source
const ( DefaultPostgresConfigPrefix = "postgres" DBPasswordModePlain = "plain" DBPasswordModeGCP = "gcp-secret-manager" )
Variables ¶
This section is empty.
Functions ¶
func BatchCreateCLBlocks ¶
func BatchCreateELBlocks ¶
func BatchUpsertELRewards ¶
func GetCLValidatorsVotes ¶
func InsertCLTotalStake ¶
func InsertCLTotalStake(db *gorm.DB, indexer string, stake *CLTotalStake) error
func NewPostgresClient ¶
func SetupIndexPoint ¶
func SetupIndexPoint(db *gorm.DB, indexPoint *IndexPoint) error
Types ¶
type CLBlock ¶
type CLBlock struct { ID uint64 `gorm:"primarykey"` Height int64 `gorm:"not null;column:height;index:idx_cl_block_height,unique"` Hash string `gorm:"not null;column:hash;index:idx_cl_block_hash,unique"` ProposerAddress string `gorm:"not null;column:proposer_address"` Time time.Time `gorm:"not null;column:time"` }
type CLStakingEvent ¶
type CLStakingEvent struct { ID uint64 `gorm:"primarykey"` ELTxHash string `gorm:"not null;column:el_tx_hash;index:idx_cl_staking_event_el_tx_hash_event_type,priority:1"` EventType string `gorm:"not null;column:event_type;index:idx_cl_staking_event_el_tx_hash_event_type,priority:2"` BlockHeight int64 `gorm:"not null;column:block_height;index:idx_cl_staking_event_block_height"` StatusOK bool `gorm:"not null;column:status_ok"` ErrorCode string `gorm:"not null;column:error_code"` Amount string `gorm:"not null;column:amount"` }
func (CLStakingEvent) TableName ¶
func (CLStakingEvent) TableName() string
type CLTotalStake ¶
type CLTotalStake struct { ID uint64 `gorm:"primarykey"` UpdateAt int64 `gorm:"not null;column:update_at;index:idx_cl_total_stake_update_at,unique"` TotalStakeAmount int64 `gorm:"not null;column:total_stake_amount"` }
func GetCLTotalStakes ¶
func GetCLTotalStakes(db *gorm.DB) ([]*CLTotalStake, error)
func GetCLTotalStakesAfter ¶
func GetCLTotalStakesAfter(db *gorm.DB, timestamp int64) ([]*CLTotalStake, error)
func GetLatestCLTotalStake ¶
func GetLatestCLTotalStake(db *gorm.DB) (*CLTotalStake, error)
func GetLatestCLTotalStakeBefore ¶
func GetLatestCLTotalStakeBefore(db *gorm.DB, timestamp int64) (*CLTotalStake, error)
func (CLTotalStake) TableName ¶
func (CLTotalStake) TableName() string
type CLValidatorVote ¶
type CLValidatorVote struct { ID uint64 `gorm:"primarykey"` Validator string `gorm:"not null;column:validator;index:idx_cl_validator_vote_validator_block_height,priority:1,unique"` // To lower case BlockHeight int64 `gorm:"not null;column:block_height;index:idx_cl_validator_vote_validator_block_height,priority:2,unique"` }
func (CLValidatorVote) TableName ¶
func (CLValidatorVote) TableName() string
type ELBlock ¶
type ELBlock struct { ID uint64 `gorm:"primarykey"` Height int64 `gorm:"not null;column:height;index:idx_el_block_height,unique"` Hash string `gorm:"not null;column:hash;index:idx_el_block_hash,unique"` GasUsed uint64 `gorm:"not null"` GasLimit uint64 `gorm:"not null"` Time time.Time `gorm:"not null;column:time"` }
type ELReward ¶
type ELStakingEvent ¶
type ELStakingEvent struct { ID uint64 `gorm:"primarykey"` TxHash string `gorm:"not null;column:tx_hash;index:idx_el_staking_event_tx_hash_event_type,priority:1"` EventType string `gorm:"not null;column:event_type;index:idx_el_staking_event_tx_hash_event_type,priority:2"` Address string `gorm:"not null;column:address;index:idx_el_staking_event_address_block_height,priority:1"` // To lower case BlockHeight int64 `gorm:"not null;column:block_height;index:idx_el_staking_event_address_block_height,priority:2"` SrcValidatorAddress string `gorm:"not null;column:src_validator_address"` DstValidatorAddress string `gorm:"not null;column:dst_validator_address"` DstAddress string `gorm:"not null;column:dst_address"` // RewardAddrss | WithdrawAddress | OperatorAddress }
func (ELStakingEvent) TableName ¶
func (ELStakingEvent) TableName() string
type IndexPoint ¶
type IndexPoint struct { ID uint64 `gorm:"primarykey"` Indexer string `gorm:"not null;column:indexer;index:idx_index_point_indexer,unique"` BlockHeight int64 `gorm:"not null;column:block_height"` }
func GetIndexPoint ¶
func GetIndexPoint(db *gorm.DB, indexer string) (*IndexPoint, error)
func (IndexPoint) TableName ¶
func (IndexPoint) TableName() string
type MetricsPlugin ¶
type MetricsPlugin struct{}
func (*MetricsPlugin) Initialize ¶
func (p *MetricsPlugin) Initialize(db *gorm.DB) (err error)
func (*MetricsPlugin) Name ¶
func (p *MetricsPlugin) Name() string
type Operation ¶
type Operation struct { TxHash string `gorm:"column:tx_hash" json:"tx_hash"` BlockHeight int64 `gorm:"column:block_height" json:"block_height"` EventType string `gorm:"column:event_type" json:"event_type"` Address string `gorm:"column:address" json:"address"` SrcValidatorAddress string `gorm:"column:src_validator_address" json:"src_validator_address"` DstValidatorAddress string `gorm:"column:dst_validator_address" json:"dst_validator_address"` DstAddress string `gorm:"column:dst_address" json:"dst_address"` StatusOK bool `gorm:"column:status_ok" json:"status_ok"` ErrorCode string `gorm:"column:error_code" json:"error_code"` Amount string `gorm:"column:amount;type:numeric" json:"amount"` }
type PostgresConfig ¶
type PostgresConfig struct { DBUsername string `yaml:"db-username" envconfig:"DB_USERNAME"` DBPasswordMode string `yaml:"db-password-mode" envconfig:"DB_PASSWORD_MODE"` DBPassword string `yaml:"db-password" envconfig:"DB_PASSWORD"` DBHost string `yaml:"db-host" envconfig:"DB_HOST"` DBPort int `yaml:"db-port" envconfig:"DB_PORT"` DBName string `yaml:"db-name" envconfig:"DB_NAME"` DBMaxConns int `yaml:"db-max-conns" envconfig:"DB_MAX_CONNS"` DBMinConns int `yaml:"db-min-conns" envconfig:"DB_MIN_CONNS"` DBMaxConnLifetime time.Duration `yaml:"db-max-conn-lifetime" envconfig:"DB_MAX_CONN_LIFETIME"` DBMaxConnIdleTime time.Duration `yaml:"db-max-conn-idle-time" envconfig:"DB_MAX_CONN_IDLE_TIME"` }
Click to show internal directories.
Click to hide internal directories.