types

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveEmpty

func RemoveEmpty(s []string) []string

func ToNullString

func ToNullString(value string) sql.NullString

func ToString

func ToString(value sql.NullString) string

Types

type AccountRow

type AccountRow struct {
	Address string `db:"address"`
}

AccountRow represents a single row inside the account table

func NewAccountRow

func NewAccountRow(address string) AccountRow

NewAccountRow allows to easily build a new AccountRow

func (AccountRow) Equal

func (a AccountRow) Equal(b AccountRow) bool

Equal tells whether a and b contain the same data

type AverageTimeRow

type AverageTimeRow struct {
	OneRowID    bool    `db:"one_row_id"`
	AverageTime float64 `db:"average_time"`
	Height      int64   `db:"height"`
}

AverageTimeRow is the average block time each minute/hour/day

func NewAverageTimeRow

func NewAverageTimeRow(averageTime float64, height int64) AverageTimeRow

func (AverageTimeRow) Equal

func (r AverageTimeRow) Equal(s AverageTimeRow) bool

Equal return true if two AverageTimeRow are true

type BlockRow

type BlockRow struct {
	Height          int64          `db:"height"`
	Hash            string         `db:"hash"`
	TxNum           int64          `db:"num_txs"`
	TotalGas        int64          `db:"total_gas"`
	ProposerAddress sql.NullString `db:"proposer_address"`
	PreCommitsNum   int64          `db:"pre_commits"`
	Timestamp       time.Time      `db:"timestamp"`
}

BlockRow represents a single block row stored inside the database

type CommunityPoolRow

type CommunityPoolRow struct {
	OneRowID bool        `db:"one_row_id"`
	Coins    *DbDecCoins `db:"coins"`
	Height   int64       `db:"height"`
}

CommunityPoolRow represents a single row inside the total_supply table

func NewCommunityPoolRow

func NewCommunityPoolRow(coins DbDecCoins, height int64) CommunityPoolRow

NewCommunityPoolRow allows to easily create a new CommunityPoolRow

func (CommunityPoolRow) Equals

Equals return true if one CommunityPoolRow representing the same row as the original one

type ConsensusRow

type ConsensusRow struct {
	Step     string `db:"step"`
	Height   int64  `db:"height"`
	Round    int32  `db:"round"`
	OneRowID bool   `db:"one_row_id"`
}

ConsensusRow represents a single row inside the consensus table

func NewConsensusRow

func NewConsensusRow(height int64, round int32, step string) ConsensusRow

NewConsensusRow allows to build a new ConsensusRow instance

func (ConsensusRow) Equal

func (r ConsensusRow) Equal(s ConsensusRow) bool

Equal tells whether r and s contain the same data

type DbCoin

type DbCoin struct {
	Denom  string
	Amount string
}

DbCoin represents the information stored inside the database about a single coin

func NewDbCoin

func NewDbCoin(coin sdk.Coin) DbCoin

NewDbCoin builds a DbCoin starting from an SDK Coin

func (DbCoin) Equal

func (coin DbCoin) Equal(d DbCoin) bool

Equal tells whether coin and d represent the same coin with the same amount

func (*DbCoin) Scan

func (coin *DbCoin) Scan(src interface{}) error

Scan implements sql.Scanner

func (DbCoin) ToCoin

func (coin DbCoin) ToCoin() sdk.Coin

ToCoin converts this DbCoin to sdk.Coin

func (*DbCoin) Value

func (coin *DbCoin) Value() (driver.Value, error)

Value implements driver.Valuer

type DbCoins

type DbCoins []*DbCoin

DbCoins represents an array of coins

func NewDbCoins

func NewDbCoins(coins sdk.Coins) DbCoins

NewDbCoins build a new DbCoins object starting from an array of coins

func (DbCoins) Equal

func (coins DbCoins) Equal(d *DbCoins) bool

Equal tells whether c and d contain the same items in the same order

func (*DbCoins) Scan

func (coins *DbCoins) Scan(src interface{}) error

Scan implements sql.Scanner

func (DbCoins) ToCoins

func (coins DbCoins) ToCoins() sdk.Coins

ToCoins converts this DbCoins to sdk.Coins

type DbDecCoin

type DbDecCoin struct {
	Denom  string
	Amount string
}

DbDecCoin represents the information stored inside the database about a single coin

func NewDbDecCoin

func NewDbDecCoin(coin sdk.DecCoin) DbDecCoin

NewDbDecCoin builds a DbDecCoin starting from an SDK Coin

func (DbDecCoin) Equal

func (coin DbDecCoin) Equal(d DbDecCoin) bool

Equal tells whether coin and d represent the same coin with the same amount

func (*DbDecCoin) Scan

func (coin *DbDecCoin) Scan(src interface{}) error

Scan implements sql.Scanner

func (DbDecCoin) ToDecCoin

func (coin DbDecCoin) ToDecCoin() sdk.DecCoin

ToDecCoin converts this DbDecCoin to sdk.DecCoin

func (*DbDecCoin) Value

func (coin *DbDecCoin) Value() (driver.Value, error)

Value implements driver.Valuer

type DbDecCoins

type DbDecCoins []*DbDecCoin

DbDecCoins represents an array of coins

func NewDbDecCoins

func NewDbDecCoins(coins sdk.DecCoins) DbDecCoins

NewDbDecCoins build a new DbDecCoins object starting from an array of coins

func (DbDecCoins) Equal

func (coins DbDecCoins) Equal(d *DbDecCoins) bool

Equal tells whether c and d contain the same items in the same order

func (*DbDecCoins) Scan

func (coins *DbDecCoins) Scan(src interface{}) error

Scan implements sql.Scanner

func (DbDecCoins) ToDecCoins

func (coins DbDecCoins) ToDecCoins() sdk.DecCoins

ToDecCoins converts this DbDecCoins to sdk.DecCoins

type DepositRow

type DepositRow struct {
	ProposalID int64   `db:"proposal_id"`
	Depositor  string  `db:"depositor_address"`
	Amount     DbCoins `db:"amount"`
	Height     int64   `db:"height"`
}

DepositRow represents a single row inside the deposit table

func NewDepositRow

func NewDepositRow(
	proposalID int64,
	depositor string,
	amount DbCoins,
	height int64,
) DepositRow

NewDepositRow allows to easily create a new NewDepositRow

func (DepositRow) Equals

func (w DepositRow) Equals(v DepositRow) bool

Equals return true if two VoteDepositRow are the same

type DistributionParamsRow

type DistributionParamsRow struct {
	OneRowID bool   `db:"one_row_id"`
	Params   string `db:"params"`
	Height   int64  `db:"height"`
}

DistributionParamsRow represents a single row inside the distribution_params table

type DoubleSignEvidenceRow

type DoubleSignEvidenceRow struct {
	Height  int64 `db:"height"`
	VoteAID int64 `db:"vote_a_id"`
	VoteBID int64 `db:"vote_b_id"`
}

DoubleSignEvidenceRow represents a single row of the double_sign_evidence table

func NewDoubleSignEvidenceRow

func NewDoubleSignEvidenceRow(height int64, voteAID int64, voteBID int64) DoubleSignEvidenceRow

NewDoubleSignEvidenceRow allows to build a new NewDoubleSignEvidenceRow

func (DoubleSignEvidenceRow) Equal

Equal tells whether v and w represent the same rows

type DoubleSignVoteRow

type DoubleSignVoteRow struct {
	ID               int64  `db:"id"`
	VoteType         int    `db:"type"`
	Height           int64  `db:"height"`
	Round            int    `db:"round"`
	BlockID          string `db:"block_id"`
	ValidatorAddress string `db:"validator_address"`
	ValidatorIndex   int    `db:"validator_index"`
	Signature        string `db:"signature"`
}

DoubleSignVoteRow represents a single row of the double_sign_vote table

func NewDoubleSignVoteRow

func NewDoubleSignVoteRow(
	id int64,
	voteType int,
	height int64,
	round int,
	blockID string,
	validatorAddress string,
	validatorIndex int,
	signature string,
) DoubleSignVoteRow

NewDoubleSignVoteRow allows to build a new NewDoubleSignVoteRow

func (DoubleSignVoteRow) Equal

Equal tells whether v and w represent the same rows

type FeeAllowanceRow

type FeeAllowanceRow struct {
	ID        uint64 `db:"id"`
	Grantee   string `db:"grantee_address"`
	Granter   string `db:"granter_address"`
	Allowance string `db:"allowance"`
	Height    int64  `db:"height"`
}

FeeAllowanceRow represents a single row inside the fee_grant_allowance table

type GenesisRow

type GenesisRow struct {
	OneRowID      bool      `db:"one_row_id"`
	ChainID       string    `db:"chain_id"`
	Time          time.Time `db:"time"`
	InitialHeight int64     `db:"initial_height"`
}

func NewGenesisRow

func NewGenesisRow(chainID string, time time.Time, initialHeight int64) GenesisRow

func (GenesisRow) Equal

func (r GenesisRow) Equal(s GenesisRow) bool

type GovParamsRow

type GovParamsRow struct {
	OneRowID      bool   `db:"one_row_id"`
	DepositParams string `db:"deposit_params"`
	VotingParams  string `db:"voting_params"`
	TallyParams   string `db:"tally_params"`
	Height        int64  `db:"height"`
}

GovParamsRow represents a single row of the "gov_params" table

type InflationRow

type InflationRow struct {
	OneRowID bool    `db:"one_row_id"`
	Value    float64 `db:"value"`
	Height   int64   `db:"height"`
}

InflationRow represents a single row inside the inflation table

func NewInflationRow

func NewInflationRow(value float64, height int64) InflationRow

NewInflationRow builds a new InflationRows instance

func (InflationRow) Equal

func (i InflationRow) Equal(j InflationRow) bool

Equal reports whether i and j represent the same table rows.

type MintParamsRow

type MintParamsRow struct {
	OneRowID bool   `db:"one_row_id"`
	Params   string `db:"params"`
	Height   int64  `db:"height"`
}

MintParamsRow represents a single row inside the mint_params table

func NewMintParamsRow

func NewMintParamsRow(
	params string, height int64,
) MintParamsRow

NewMintParamsRow builds a new MintParamsRow instance

func (MintParamsRow) Equal

func (m MintParamsRow) Equal(n MintParamsRow) bool

Equal reports whether m and n represent the same table rows.

type ModuleRow

type ModuleRow struct {
	Module string `db:"module_name"`
}

ModuleRow represents a single row inside the modules table

func (ModuleRow) Equal

func (v ModuleRow) Equal(w ModuleRow) bool

Equal return true if two moduleRow is equal

type ModuleRows

type ModuleRows []*ModuleRow

ModuleRows represent an array of ModulerRow

func NewModuleRows

func NewModuleRows(names []string) ModuleRows

NewModuleRows return a new instance of ModuleRows

func (ModuleRows) Equal

func (v ModuleRows) Equal(w *ModuleRows) bool

Equal return true if two ModulesRow is equal

type ProposalRow

type ProposalRow struct {
	Title           string    `db:"title"`
	Description     string    `db:"description"`
	Content         string    `db:"content"`
	ProposalRoute   string    `db:"proposal_route"`
	ProposalType    string    `db:"proposal_type"`
	ProposalID      uint64    `db:"id"`
	SubmitTime      time.Time `db:"submit_time"`
	DepositEndTime  time.Time `db:"deposit_end_time"`
	VotingStartTime time.Time `db:"voting_start_time"`
	VotingEndTime   time.Time `db:"voting_end_time"`
	Proposer        string    `db:"proposer_address"`
	Status          string    `db:"status"`
}

ProposalRow represents a single row inside the proposal table

func NewProposalRow

func NewProposalRow(
	proposalID uint64,
	proposalRoute string,
	proposalType string,
	title string,
	description string,
	content string,
	submitTime time.Time,
	depositEndTime time.Time,
	votingStartTime time.Time,
	votingEndTime time.Time,
	proposer string,
	status string,
) ProposalRow

NewProposalRow allows to easily create a new ProposalRow

func (ProposalRow) Equals

func (w ProposalRow) Equals(v ProposalRow) bool

Equals return true if two ProposalRow are the same

type ProposalStakingPoolSnapshotRow

type ProposalStakingPoolSnapshotRow struct {
	ProposalID      uint64 `db:"proposal_id"`
	BondedTokens    int64  `db:"bonded_tokens"`
	NotBondedTokens int64  `db:"not_bonded_tokens"`
	Height          int64  `db:"height"`
}

func NewProposalStakingPoolSnapshotRow

func NewProposalStakingPoolSnapshotRow(proposalID uint64, bondedTokens, notBondedTokens, height int64) ProposalStakingPoolSnapshotRow

type ProposalValidatorVotingPowerSnapshotRow

type ProposalValidatorVotingPowerSnapshotRow struct {
	ID               int64  `db:"id"`
	ProposalID       int64  `db:"proposal_id"`
	ValidatorAddress string `db:"validator_address"`
	VotingPower      int64  `db:"voting_power"`
	Status           int    `db:"status"`
	Jailed           bool   `db:"jailed"`
	Height           int64  `db:"height"`
}

func NewProposalValidatorVotingPowerSnapshotRow

func NewProposalValidatorVotingPowerSnapshotRow(
	id int64, proposalID int64, validatorAddr string, votingPower int64, status int, jailed bool, height int64,
) ProposalValidatorVotingPowerSnapshotRow

type SlashingParamsRow

type SlashingParamsRow struct {
	OneRowID bool   `db:"one_row_id"`
	Params   string `db:"params"`
	Height   int64  `db:"height"`
}

SlashingParamsRow represents a single row inside the slashing_params table

func NewSlashingParamsRow

func NewSlashingParamsRow(params string, height int64) SlashingParamsRow

NewSlashingParamsRow allows to create a new instance SlashingParamsRow

type StakingParamsRow

type StakingParamsRow struct {
	OneRowID bool   `db:"one_row_id"`
	Params   string `db:"params"`
	Height   int64  `db:"height"`
}

StakingParamsRow represents a single row inside the staking_params table

type StakingPoolRow

type StakingPoolRow struct {
	OneRowID        bool  `db:"one_row_id"`
	BondedTokens    int64 `db:"bonded_tokens"`
	NotBondedTokens int64 `db:"not_bonded_tokens"`
	Height          int64 `db:"height"`
}

StakingPoolRow represents a single row inside the staking_pool table

func NewStakingPoolRow

func NewStakingPoolRow(bondedTokens, notBondedTokens int64, height int64) StakingPoolRow

NewStakingPoolRow allows to easily create a new StakingPoolRow

func (StakingPoolRow) Equal

func (r StakingPoolRow) Equal(s StakingPoolRow) bool

Equal allows to tells whether r and as represent the same rows

type SupplyRow

type SupplyRow struct {
	OneRowID bool     `db:"one_row_id"`
	Coins    *DbCoins `db:"coins"`
	Height   int64    `db:"height"`
}

SupplyRow represents a single row inside the "supply" table

func NewSupplyRow

func NewSupplyRow(coins DbCoins, height int64) SupplyRow

NewSupplyRow allows to easily create a new NewSupplyRow

func (SupplyRow) Equals

func (v SupplyRow) Equals(w SupplyRow) bool

Equals return true if one totalSupplyRow representing the same row as the original one

type TallyResultRow

type TallyResultRow struct {
	ProposalID int64  `db:"proposal_id"`
	Yes        string `db:"yes"`
	Abstain    string `db:"abstain"`
	No         string `db:"no"`
	NoWithVeto string `db:"no_with_veto"`
	Height     int64  `db:"height"`
}

TallyResultRow represents a single row inside the tally_result table

func NewTallyResultRow

func NewTallyResultRow(
	proposalID int64,
	yes string,
	abstain string,
	no string,
	noWithVeto string,
	height int64,
) TallyResultRow

NewTallyResultRow return a new TallyResultRow instance

func (TallyResultRow) Equals

func (w TallyResultRow) Equals(v TallyResultRow) bool

Equals return true if two TallyResultRow are the same

type TokenPriceRow

type TokenPriceRow struct {
	ID        string    `db:"id"`
	Name      string    `db:"unit_name"`
	Price     float64   `db:"price"`
	MarketCap int64     `db:"market_cap"`
	Timestamp time.Time `db:"timestamp"`
}

TokenPriceRow represent a row of the table token_price in the database

func NewTokenPriceRow

func NewTokenPriceRow(name string, currentPrice float64, marketCap int64, timestamp time.Time) TokenPriceRow

NewTokenPriceRow allows to easily create a new NewTokenPriceRow

func (TokenPriceRow) Equals

func (u TokenPriceRow) Equals(v TokenPriceRow) bool

Equals return true if u and v represent the same row

type TokenRow

type TokenRow struct {
	Name       string `db:"name"`
	TradedUnit string `db:"traded_unit"`
}

type TokenUnitRow

type TokenUnitRow struct {
	TokenName string         `db:"token_name"`
	Denom     string         `db:"denom"`
	Exponent  int            `db:"exponent"`
	Aliases   pq.StringArray `db:"aliases"`
	PriceID   sql.NullString `db:"price_id"`
}

type ValidatorCommissionRow

type ValidatorCommissionRow struct {
	OperatorAddress   string         `db:"validator_address"`
	Commission        sql.NullString `db:"commission"`
	MinSelfDelegation sql.NullString `db:"min_self_delegation"`
	Height            int64          `db:"height"`
}

ValidatorCommissionRow represents a single row of the validator_commission database table

func NewValidatorCommissionRow

func NewValidatorCommissionRow(
	operatorAddress string, commission string, minSelfDelegation string, height int64,
) ValidatorCommissionRow

NewValidatorCommissionRow allows to easily build a new ValidatorCommissionRow instance

func (ValidatorCommissionRow) Equal

Equal tells whether v and w represent the same rows

type ValidatorData

type ValidatorData struct {
	ConsAddress         string `db:"consensus_address"`
	ValAddress          string `db:"operator_address"`
	ConsPubKey          string `db:"consensus_pubkey"`
	SelfDelegateAddress string `db:"self_delegate_address"`
	MaxRate             string `db:"max_rate"`
	MaxChangeRate       string `db:"max_change_rate"`
	Height              int64  `db:"height"`
}

ValidatorData contains all the data of a single validator. It implements types.Validator interface

func NewValidatorData

func NewValidatorData(
	consAddress, valAddress, consPubKey, selfDelegateAddress, maxRate, maxChangeRate string, height int64,
) ValidatorData

NewValidatorData allows to build a new ValidatorData

func (ValidatorData) GetConsAddr

func (v ValidatorData) GetConsAddr() string

GetConsAddr implements types.Validator

func (ValidatorData) GetConsPubKey

func (v ValidatorData) GetConsPubKey() string

GetConsPubKey implements types.Validator

func (ValidatorData) GetHeight

func (v ValidatorData) GetHeight() int64

GetHeight implements types.Validator

func (ValidatorData) GetMaxChangeRate

func (v ValidatorData) GetMaxChangeRate() *sdk.Dec

GetMaxChangeRate implements types.Validator

func (ValidatorData) GetMaxRate

func (v ValidatorData) GetMaxRate() *sdk.Dec

GetMaxRate implements types.Validator

func (ValidatorData) GetOperator

func (v ValidatorData) GetOperator() string

GetOperator implements types.Validator

func (ValidatorData) GetSelfDelegateAddress

func (v ValidatorData) GetSelfDelegateAddress() string

GetSelfDelegateAddress implements types.Validator

type ValidatorDescriptionRow

type ValidatorDescriptionRow struct {
	ValAddress      string         `db:"validator_address"`
	Moniker         sql.NullString `db:"moniker"`
	Identity        sql.NullString `db:"identity"`
	AvatarURL       sql.NullString `db:"avatar_url"`
	Website         sql.NullString `db:"website"`
	SecurityContact sql.NullString `db:"security_contact"`
	Details         sql.NullString `db:"details"`
	Height          int64          `db:"height"`
}

ValidatorDescriptionRow represent a row in validator_description

func NewValidatorDescriptionRow

func NewValidatorDescriptionRow(
	valAddress, moniker, identity, avatarURL, website, securityContact, details string, height int64,
) ValidatorDescriptionRow

NewValidatorDescriptionRow return a row representing data structure in validator_description

func (ValidatorDescriptionRow) Equals

Equals return true if two ValidatorDescriptionRow are equal

type ValidatorInfoRow

type ValidatorInfoRow struct {
	ConsAddress         string `db:"consensus_address"`
	ValAddress          string `db:"operator_address"`
	SelfDelegateAddress string `db:"self_delegate_address"`
	MaxChangeRate       string `db:"max_change_rate"`
	MaxRate             string `db:"max_rate"`
	Height              int64  `db:"height"`
}

ValidatorInfoRow represents a single row of the validator_info table

func NewValidatorInfoRow

func NewValidatorInfoRow(
	consAddress, valAddress, selfDelegateAddress, maxRate, maxChangeRate string, height int64,
) ValidatorInfoRow

NewValidatorInfoRow allows to build a new ValidatorInfoRow

func (ValidatorInfoRow) Equal

Equal tells whether v and w represent the same rows

type ValidatorRow

type ValidatorRow struct {
	ConsAddress string `db:"consensus_address"`
	ConsPubKey  string `db:"consensus_pubkey"`
}

ValidatorRow represents a single row of the validator table

func NewValidatorRow

func NewValidatorRow(consAddress, consPubKey string) ValidatorRow

NewValidatorRow returns a new ValidatorRow

func (ValidatorRow) Equal

func (v ValidatorRow) Equal(w ValidatorRow) bool

Equal tells whether v and w contain the same data

type ValidatorSigningInfoRow

type ValidatorSigningInfoRow struct {
	ValidatorAddress    string    `db:"validator_address"`
	StartHeight         int64     `db:"start_height"`
	IndexOffset         int64     `db:"index_offset"`
	JailedUntil         time.Time `db:"jailed_until"`
	Tombstoned          bool      `db:"tombstoned"`
	MissedBlocksCounter int64     `db:"missed_blocks_counter"`
	Height              int64     `db:"height"`
}

ValidatorSigningInfoRow represents a single row of the validator_signing_info table

func NewValidatorSigningInfoRow

func NewValidatorSigningInfoRow(
	validatorAddress string,
	startHeight int64,
	indexOffset int64,
	jailedUntil time.Time,
	tombstoned bool,
	missedBlocksCounter int64,
	height int64,
) ValidatorSigningInfoRow

NewValidatorSigningInfoRow allows to build a new ValidatorSigningInfoRow

func (ValidatorSigningInfoRow) Equal

Equal tells whether v and w represent the same rows

type ValidatorStatusRow

type ValidatorStatusRow struct {
	Status      int    `db:"status"`
	Jailed      bool   `db:"jailed"`
	Tombstoned  bool   `db:"tombstoned"`
	ConsAddress string `db:"validator_address"`
	Height      int64  `db:"height"`
}

ValidatorStatusRow represents a single row of the validator_status table

func NewValidatorStatusRow

func NewValidatorStatusRow(status int, jailed bool, tombstoned bool, consAddess string, height int64) ValidatorStatusRow

NewValidatorStatusRow builds a new ValidatorStatusRow

func (ValidatorStatusRow) Equal

Equal tells whether v and w contain the same data

type ValidatorVotingPowerRow

type ValidatorVotingPowerRow struct {
	ValidatorAddress string `db:"validator_address"`
	VotingPower      int64  `db:"voting_power"`
	Height           int64  `db:"height"`
}

ValidatorVotingPowerRow represents a single row of the validator_voting_power database table

func NewValidatorVotingPowerRow

func NewValidatorVotingPowerRow(address string, votingPower int64, height int64) ValidatorVotingPowerRow

NewValidatorVotingPowerRow allows to easily build a new ValidatorVotingPowerRow instance

func (ValidatorVotingPowerRow) Equal

Equal tells whether v and w represent the same rows

type VoteRow

type VoteRow struct {
	ProposalID int64  `db:"proposal_id"`
	Voter      string `db:"voter_address"`
	Option     string `db:"option"`
	Height     int64  `db:"height"`
}

VoteRow represents a single row inside the vote table

func NewVoteRow

func NewVoteRow(
	proposalID int64,
	voter string,
	option string,
	height int64,
) VoteRow

NewVoteRow allows to easily create a new VoteRow

func (VoteRow) Equals

func (w VoteRow) Equals(v VoteRow) bool

Equals return true if two VoteRow are the same

Jump to

Keyboard shortcuts

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