model

package
v0.5.2-rc3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VoteAbstain = 1
	VoteNo      = 2
	VoteYes     = 3

	ProposalStageProposed = "proposed"
	ProposalStageApproved = "approved"
	ProposalStageExecuted = "executed"
	ProposalStageDequeued = "dequeued"
	ProposalStageExpired  = "expired"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountActivitySeq added in v0.1.0

type AccountActivitySeq struct {
	*Model
	*Sequence

	TransactionHash string         `json:"transaction_hash"`
	Address         string         `json:"address"`
	Amount          types.Quantity `json:"amount"`
	Kind            string         `json:"kind"`
	Data            types.Jsonb    `json:"data"`
}

func (AccountActivitySeq) TableName added in v0.1.0

func (AccountActivitySeq) TableName() string

func (*AccountActivitySeq) Update added in v0.1.0

type Aggregate

type Aggregate struct {
	StartedAtHeight int64      `json:"started_at_height"`
	StartedAt       types.Time `json:"started_at"`
	RecentAtHeight  int64      `json:"recent_at_height"`
	RecentAt        types.Time `json:"recent_at"`
}

Aggregate is used for aggregate tables

func (*Aggregate) Equal

func (a *Aggregate) Equal(m Aggregate) bool

func (*Aggregate) Valid

func (a *Aggregate) Valid() bool

type BlockSeq

type BlockSeq struct {
	*Model
	*Sequence

	// Indexed data
	TxCount         int     `json:"tx_count"`
	Size            float64 `json:"size"`
	GasUsed         uint64  `json:"gas_used"`
	TotalDifficulty uint64  `json:"total_difficulty"`
}

func (*BlockSeq) Equal

func (b *BlockSeq) Equal(m BlockSeq) bool

func (BlockSeq) TableName

func (BlockSeq) TableName() string

func (*BlockSeq) Update

func (b *BlockSeq) Update(m BlockSeq)

func (*BlockSeq) Valid

func (b *BlockSeq) Valid() bool

type BlockSummary

type BlockSummary struct {
	*Model
	*Summary

	Count        int64   `json:"count"`
	BlockTimeAvg float64 `json:"block_time_avg"`
}

func (BlockSummary) TableName

func (BlockSummary) TableName() string

type GovernanceActivitySeq added in v0.1.0

type GovernanceActivitySeq struct {
	*Model
	*Sequence

	ProposalId      uint64      `json:"proposal_id"`
	Account         string      `json:"account"`
	TransactionHash string      `json:"transaction_hash"`
	Kind            string      `json:"kind"`
	Data            types.Jsonb `json:"data"`
}

func (GovernanceActivitySeq) TableName added in v0.1.0

func (GovernanceActivitySeq) TableName() string

func (*GovernanceActivitySeq) Update added in v0.1.0

type Job added in v0.2.0

type Job struct {
	ID         JobID      `json:"-"`
	Height     *int64     `json:"height"`
	RunCount   uint64     `json:"run_count"`
	LastError  *string    `json:"last_error"`
	StartedAt  *time.Time `json:"started_at"`
	FinishedAt *time.Time `json:"finished_at"`
	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"-"`
}

Job represents a worker job

type JobID added in v0.2.0

type JobID uint64

JobID uniquely identifies a job

type Model

type Model struct {
	ID types.ID `json:"id"`
}

Model is used for general table

type ModelWithTimestamps added in v0.1.0

type ModelWithTimestamps struct {
	ID        types.ID   `json:"id"`
	CreatedAt types.Time `json:"created_at"`
	UpdatedAt types.Time `json:"updated_at"`
}

ModelWithTimestamps is used for general table with timestamps

func (*ModelWithTimestamps) Equal added in v0.1.0

func (*ModelWithTimestamps) Valid added in v0.1.0

func (e *ModelWithTimestamps) Valid() bool

type ProposalAgg added in v0.1.0

type ProposalAgg struct {
	*ModelWithTimestamps
	*Aggregate

	ProposalId       uint64     `json:"proposal_id"`
	ProposerAddress  string     `json:"proposer_address"`
	DescriptionUrl   string     `json:"description_url"`
	Deposit          string     `json:"deposit"`
	TransactionCount int64      `json:"transaction_count"`
	ProposedAtHeight int64      `json:"proposed_at_height"`
	ProposedAt       types.Time `json:"proposed_at"`

	RecentStage string `json:"recent_stage"`

	DequeueAddress   string     `json:"dequeue_address"`
	DequeuedAtHeight int64      `json:"dequeued_at_height"`
	DequeuedAt       types.Time `json:"dequeued_at"`

	ApprovalAddress  string     `json:"approval_address"`
	ApprovedAtHeight int64      `json:"approved_at_height"`
	ApprovedAt       types.Time `json:"approved_at"`

	ExecutorAddress  string     `json:"executor_address"`
	ExecutedAtHeight int64      `json:"executed_at_height"`
	ExecutedAt       types.Time `json:"executed_at"`

	ExpiredAtHeight int64      `json:"expired_at_height"`
	ExpiredAt       types.Time `json:"expired_at"`

	UpvotesTotal            string `json:"upvotes_total"`
	YesVotesTotal           uint64 `json:"yes_votes_total"`
	YesVotesWeightTotal     string `json:"yes_votes_weight_total"`
	NoVotesTotal            uint64 `json:"no_votes_total"`
	NoVotesWeightTotal      string `json:"no_votes_weight_total"`
	AbstainVotesTotal       uint64 `json:"abstain_votes_total"`
	AbstainVotesWeightTotal string `json:"abstain_votes_weight_total"`
	VotesTotal              uint64 `json:"votes_total"`
	VotesWeightTotal        string `json:"votes_weight_total"`
}

func (*ProposalAgg) Equal added in v0.1.0

func (s *ProposalAgg) Equal(m ProposalAgg) bool

func (ProposalAgg) TableName added in v0.1.0

func (ProposalAgg) TableName() string

func (*ProposalAgg) Valid added in v0.1.0

func (s *ProposalAgg) Valid() bool

type Report

type Report struct {
	*ModelWithTimestamps

	Kind         ReportKind
	IndexVersion int64
	StartHeight  int64
	EndHeight    int64
	SuccessCount *int64
	ErrorCount   *int64
	ErrorMsg     *string
	Duration     time.Duration
	CompletedAt  *types.Time
}

func (*Report) Complete

func (r *Report) Complete(successCount int64, errorCount int64, err error)

func (*Report) Equal

func (r *Report) Equal(m Report) bool

func (Report) TableName

func (Report) TableName() string

func (*Report) Valid

func (r *Report) Valid() bool

type ReportKind

type ReportKind int
const (
	ReportKindIndex ReportKind = iota + 1
	ReportKindParallelReindex
	ReportKindSequentialReindex
)

func (ReportKind) String

func (k ReportKind) String() string

type Sequence

type Sequence struct {
	Height int64      `json:"height"`
	Time   types.Time `json:"time"`
}

Sequence is used for sequence tables

func (*Sequence) Equal

func (s *Sequence) Equal(m Sequence) bool

func (*Sequence) Valid

func (s *Sequence) Valid() bool

type Summary

type Summary struct {
	IndexVersion int64                 `json:"index_version"`
	TimeInterval types.SummaryInterval `json:"time_interval"`
	TimeBucket   types.Time            `json:"time_bucket"`
}

Summary is used for summary tables

func (*Summary) Equal

func (a *Summary) Equal(m Summary) bool

func (*Summary) Valid

func (a *Summary) Valid() bool

type Syncable

type Syncable struct {
	*ModelWithTimestamps

	Height      int64       `json:"height"`
	Time        *types.Time `json:"time"`
	ChainId     uint64      `json:"chain_id"`
	Epoch       *int64      `json:"epoch"`
	LastInEpoch *bool       `json:"last_in_epoch"`

	IndexVersion  int64          `json:"index_version"`
	Status        SyncableStatus `json:"status"`
	ReportID      types.ID       `json:"report_id"`
	StartedAt     types.Time     `json:"started_at"`
	ProcessedAt   *types.Time    `json:"processed_at"`
	Duration      time.Duration  `json:"duration"`
	RequestsCount uint64         `json:"requests_count"`
}

func (*Syncable) Equal

func (s *Syncable) Equal(m Syncable) bool

func (*Syncable) MarkProcessed

func (s *Syncable) MarkProcessed(indexVersion int64)

func (*Syncable) SetStatus

func (s *Syncable) SetStatus(newStatus SyncableStatus)

func (Syncable) TableName

func (Syncable) TableName() string

- Methods

func (*Syncable) Valid

func (s *Syncable) Valid() bool

type SyncableStatus

type SyncableStatus int
const (
	SyncableStatusRunning SyncableStatus = iota + 1
	SyncableStatusCompleted
)

type SystemEvent added in v0.1.0

type SystemEvent struct {
	*Model

	Height int64           `json:"height"`
	Time   types.Time      `json:"time"`
	Actor  string          `json:"actor"`
	Kind   SystemEventKind `json:"kind"`
	Data   types.Jsonb     `json:"data"`

	// JOIN
	ActorRecentName string `json:"actor_recent_name"`
}

func (SystemEvent) Update added in v0.1.0

func (o SystemEvent) Update(m SystemEvent)

type SystemEventKind added in v0.1.0

type SystemEventKind string
const (
	SystemEventGroupRewardChange1 SystemEventKind = "group_reward_change_1"
	SystemEventGroupRewardChange2 SystemEventKind = "group_reward_change_2"
	SystemEventGroupRewardChange3 SystemEventKind = "group_reward_change_3"
	SystemEventJoinedActiveSet    SystemEventKind = "joined_active_set"
	SystemEventLeftActiveSet      SystemEventKind = "left_active_set"
	SystemEventMissedNConsecutive SystemEventKind = "missed_n_consecutive"
	SystemEventMissedNofM         SystemEventKind = "missed_n_of_m"
)

func (SystemEventKind) String added in v0.1.0

func (o SystemEventKind) String() string

type ValidatorAgg

type ValidatorAgg struct {
	*ModelWithTimestamps
	*Aggregate

	Address                 string `json:"address"`
	RecentName              string `json:"recent_name"`
	RecentMetadataUrl       string `json:"recent_metadata_url"`
	RecentAsValidatorHeight int64  `json:"recent_as_validator_height"`
	AccumulatedUptime       int64  `json:"accumulated_uptime"`
	AccumulatedUptimeCount  int64  `json:"accumulated_uptime_count"`
}

func (*ValidatorAgg) Equal

func (s *ValidatorAgg) Equal(m ValidatorAgg) bool

func (ValidatorAgg) TableName

func (ValidatorAgg) TableName() string

- Methods

func (*ValidatorAgg) Update

func (s *ValidatorAgg) Update(u *ValidatorAgg)

func (*ValidatorAgg) Valid

func (s *ValidatorAgg) Valid() bool

type ValidatorGroupAgg

type ValidatorGroupAgg struct {
	*ModelWithTimestamps
	*Aggregate

	Address                string `json:"address"`
	RecentName             string `json:"recent_name"`
	RecentMetadataUrl      string `json:"recent_metadata_url"`
	AccumulatedUptime      int64  `json:"accumulated_uptime"`
	AccumulatedUptimeCount int64  `json:"accumulated_uptime_count"`
}

func (*ValidatorGroupAgg) Equal

func (ValidatorGroupAgg) TableName

func (ValidatorGroupAgg) TableName() string

func (*ValidatorGroupAgg) Update

func (s *ValidatorGroupAgg) Update(u *ValidatorGroupAgg)

func (*ValidatorGroupAgg) Valid

func (s *ValidatorGroupAgg) Valid() bool

type ValidatorGroupSeq

type ValidatorGroupSeq struct {
	*Model
	*Sequence

	Address          string         `json:"address"`
	Commission       types.Quantity `json:"commission"`
	ActiveVotes      types.Quantity `json:"active_votes"`
	PendingVotes     types.Quantity `json:"pending_votes"`
	VotingCap        types.Quantity `json:"voting_cap"`
	MembersCount     int            `json:"members_count"`
	MembersAvgSigned float64        `json:"members_avg_signed"`

	// Join fields
	Name        string `json:"name"`
	MetadataUrl string `json:"metadata_url"`
}

func (*ValidatorGroupSeq) Equal

func (*ValidatorGroupSeq) IsValidated added in v0.1.9

func (s *ValidatorGroupSeq) IsValidated() bool

func (ValidatorGroupSeq) TableName

func (ValidatorGroupSeq) TableName() string

func (*ValidatorGroupSeq) Update

func (s *ValidatorGroupSeq) Update(m ValidatorGroupSeq)

func (*ValidatorGroupSeq) Valid

func (s *ValidatorGroupSeq) Valid() bool

type ValidatorGroupSummary

type ValidatorGroupSummary struct {
	*Model
	*Summary

	Address string `json:"address"`

	CommissionAvg   types.Quantity `json:"commission_avg"`
	CommissionMin   types.Quantity `json:"commission_min"`
	CommissionMax   types.Quantity `json:"commission_max"`
	ActiveVotesAvg  types.Quantity `json:"active_votes_avg"`
	ActiveVotesMin  types.Quantity `json:"active_votes_min"`
	ActiveVotesMax  types.Quantity `json:"active_votes_max"`
	PendingVotesAvg types.Quantity `json:"pending_votes_avg"`
	PendingVotesMin types.Quantity `json:"pending_votes_min"`
	PendingVotesMax types.Quantity `json:"pending_votes_max"`
}

func (ValidatorGroupSummary) TableName

func (ValidatorGroupSummary) TableName() string

type ValidatorSeq

type ValidatorSeq struct {
	*Model
	*Sequence

	Address     string         `json:"address"`
	Affiliation string         `json:"affiliation"`
	Signed      *bool          `json:"signed"`
	Score       types.Quantity `json:"score"`

	// Join fields
	RecentName        string `json:"recent_name"`
	RecentMetadataUrl string `json:"recent_metadata_url"`
}

func (*ValidatorSeq) Equal

func (s *ValidatorSeq) Equal(m ValidatorSeq) bool

func (*ValidatorSeq) IsValidated added in v0.1.9

func (s *ValidatorSeq) IsValidated() bool

func (*ValidatorSeq) ScoreAsPercentage added in v0.1.0

func (s *ValidatorSeq) ScoreAsPercentage() float64

func (ValidatorSeq) TableName

func (ValidatorSeq) TableName() string

func (*ValidatorSeq) Update

func (s *ValidatorSeq) Update(m ValidatorSeq)

func (*ValidatorSeq) Valid

func (s *ValidatorSeq) Valid() bool

type ValidatorSummary

type ValidatorSummary struct {
	*Model
	*Summary

	Address string `json:"address"`

	ScoreAvg types.Quantity `json:"score_avg"`
	ScoreMin types.Quantity `json:"score_min"`
	ScoreMax types.Quantity `json:"score_max"`

	SignedAvg float64 `json:"signed_avg"`
	SignedMax int64   `json:"signed_max"`
	SignedMin int64   `json:"signed_min"`
}

func (ValidatorSummary) TableName

func (ValidatorSummary) TableName() string

Jump to

Keyboard shortcuts

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