view

package
v1.7.41 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DEPOSITORS_TABLE_NAME = "view_proposal_depositors"
View Source
const DEPOSITORS_TOTAL_TABLE_NAME = "view_proposal_depositors_total"
View Source
const PARAMS_TABLE_NAME = "view_proposal_params"
View Source
const PROPOSALS_TABLE_NAME = "view_proposals"
View Source
const PROPOSAL_STATUS_DEPOSIT_PERIOD = "DEPOSIT_PERIOD"
View Source
const PROPOSAL_STATUS_FAILED = "FAILED"
View Source
const PROPOSAL_STATUS_INACTIVE = "INACTIVE"
View Source
const PROPOSAL_STATUS_PASSED = "PASSED"
View Source
const PROPOSAL_STATUS_REJECTED = "REJECTED"
View Source
const PROPOSAL_STATUS_VOTING_PERIOD = "VOTING_PERIOD"
View Source
const VALIDATORS_TABLE_NAME = "view_proposal_validators"
View Source
const VOTES_TABLE_NAME = "view_proposal_votes"
View Source
const VOTES_TOTAL_TABLE_NAME = "view_proposal_votes_total"

Variables

This section is empty.

Functions

This section is empty.

Types

type DepositorListOrder

type DepositorListOrder struct {
	DepositAtBlockHeight view.ORDER
}

type DepositorRow

type DepositorRow struct {
	ProposalId                    string          `json:"proposalId"`
	DepositorAddress              string          `json:"depositorAddress"`
	MaybeDepositorOperatorAddress *string         `json:"maybeDepositorValidatorAddress"`
	TransactionHash               string          `json:"transactionHash"`
	DepositAtBlockHeight          int64           `json:"depositAtBlockHeight"`
	DepositAtBlockTime            utctime.UTCTime `json:"depositAtBlockTime"`
	Amount                        coin.Coins      `json:"amount"`
}

type DepositorWithMonikerRow

type DepositorWithMonikerRow struct {
	DepositorRow

	MaybeDepositorMoniker *string `json:"maybeDepositorMoniker"`
}

type Depositors

type Depositors interface {
	Insert(row *DepositorRow) error
	ListByProposalId(
		proposalId string,
		order DepositorListOrder,
		pagination *pagination.Pagination,
	) (
		[]DepositorWithMonikerRow,
		*pagination.PaginationResult,
		error,
	)
}

func NewDepositorsView

func NewDepositorsView(handle *rdb.Handle) Depositors

func NewMockDepositorsView

func NewMockDepositorsView() Depositors

type DepositorsTotal

type DepositorsTotal interface {
	Set(string, int64) error
	Increment(string, int64) error
	IncrementAll([]string, int64) error
	DecrementAll([]string, int64) error
	FindBy(string) (int64, error)
	SumBy([]string) (int64, error)
}

func NewDepositorsTotalView

func NewDepositorsTotalView(rdbHandle *rdb.Handle) DepositorsTotal

func NewMockDepositorsTotalView

func NewMockDepositorsTotalView(_ *rdb.Handle) DepositorsTotal

type DepositorsTotalView

type DepositorsTotalView struct {
	*view.Total
}

type DepositorsView

type DepositorsView struct {
	// contains filtered or unexported fields
}

func (*DepositorsView) Insert

func (depositorsView *DepositorsView) Insert(row *DepositorRow) error

func (*DepositorsView) ListByProposalId

func (depositorsView *DepositorsView) ListByProposalId(
	proposalId string,
	order DepositorListOrder,
	pagination *pagination.Pagination,
) ([]DepositorWithMonikerRow, *pagination.PaginationResult, error)

type MockDepositorsTotalView

type MockDepositorsTotalView struct {
	mock.Mock
}

func (*MockDepositorsTotalView) DecrementAll

func (view *MockDepositorsTotalView) DecrementAll(identities []string, total int64) error

func (*MockDepositorsTotalView) FindBy

func (view *MockDepositorsTotalView) FindBy(identity string) (int64, error)

func (*MockDepositorsTotalView) Increment

func (view *MockDepositorsTotalView) Increment(identity string, total int64) error

func (*MockDepositorsTotalView) IncrementAll

func (view *MockDepositorsTotalView) IncrementAll(identities []string, total int64) error

func (*MockDepositorsTotalView) Set

func (view *MockDepositorsTotalView) Set(identity string, total int64) error

func (*MockDepositorsTotalView) SumBy

func (view *MockDepositorsTotalView) SumBy(identities []string) (int64, error)

type MockDepositorsView

type MockDepositorsView struct {
	testify_mock.Mock
}

func (*MockDepositorsView) Insert

func (depositorsView *MockDepositorsView) Insert(row *DepositorRow) error

func (*MockDepositorsView) ListByProposalId

func (depositorsView *MockDepositorsView) ListByProposalId(
	proposalId string,
	order DepositorListOrder,
	pagination *pagination2.Pagination,
) (
	[]DepositorWithMonikerRow,
	*pagination2.PaginationResult,
	error,
)

type MockProposalsView

type MockProposalsView struct {
	testify_mock.Mock
}

func (*MockProposalsView) FindById

func (proposalsView *MockProposalsView) FindById(
	proposalId string,
) (
	*ProposalWithMonikerRow,
	error,
)

func (*MockProposalsView) IncrementTotalVoteBy

func (proposalsView *MockProposalsView) IncrementTotalVoteBy(
	proposalId uint64,
	voteToAdd *big.Int,
) error

func (*MockProposalsView) Insert

func (proposalsView *MockProposalsView) Insert(row *ProposalRow) error

func (*MockProposalsView) List

func (*MockProposalsView) Update

func (proposalsView *MockProposalsView) Update(row *ProposalRow) error

type MockVotesTotalView

type MockVotesTotalView struct {
	mock.Mock
}

func (*MockVotesTotalView) DecrementAll

func (view *MockVotesTotalView) DecrementAll(identities []string, total int64) error

func (*MockVotesTotalView) FindBy

func (view *MockVotesTotalView) FindBy(identity string) (int64, error)

func (*MockVotesTotalView) Increment

func (view *MockVotesTotalView) Increment(identity string, total int64) error

func (*MockVotesTotalView) IncrementAll

func (view *MockVotesTotalView) IncrementAll(identities []string, total int64) error

func (*MockVotesTotalView) Set

func (view *MockVotesTotalView) Set(identity string, total int64) error

func (*MockVotesTotalView) SumBy

func (view *MockVotesTotalView) SumBy(identities []string) (int64, error)

type MockVotesView

type MockVotesView struct {
	testify_mock.Mock
}

func (*MockVotesView) DeleteByProposalIdVoter added in v1.7.0

func (votesView *MockVotesView) DeleteByProposalIdVoter(proposalId string, voterAddress string) (int64, error)

func (*MockVotesView) FindByProposalIdVoter

func (votesView *MockVotesView) FindByProposalIdVoter(
	proposalId string,
	voterAddress string,
) (
	[]VoteWithMonikerRow,
	error,
)

func (*MockVotesView) Insert

func (votesView *MockVotesView) Insert(row *VoteRow) error

func (*MockVotesView) ListByProposalId

func (votesView *MockVotesView) ListByProposalId(
	proposalId string,
	order VoteListOrder,
	pagination *pagination2.Pagination,
) (
	[]VoteWithMonikerRow,
	*pagination2.PaginationResult,
	error,
)

type ProposalListFilter

type ProposalListFilter struct {
	MaybeStatus *string
}

type ProposalListOrder

type ProposalListOrder struct {
	Id view.ORDER
}

type ProposalRow

type ProposalRow struct {
	ProposalId                   string           `json:"id"`
	Title                        string           `json:"title"`
	Description                  string           `json:"description"`
	Type                         string           `json:"type"`
	Status                       string           `json:"status"`
	ProposerAddress              string           `json:"proposerAddress"`
	MaybeProposerOperatorAddress *string          `json:"maybeProposerOperatorAddress"`
	Data                         interface{}      `json:"data"`
	InitialDeposit               coin.Coins       `json:"initialDeposit"`
	TotalDeposit                 coin.Coins       `json:"totalDeposit"`
	TotalVote                    *big.Int         `json:"totalVote"`
	TransactionHash              string           `json:"transactionHash"`
	SubmitBlockHeight            int64            `json:"submitBlockHeight"`
	SubmitTime                   utctime.UTCTime  `json:"submitTime"`
	DepositEndTime               utctime.UTCTime  `json:"depositEndTime"`
	MaybeVotingStartTime         *utctime.UTCTime `json:"maybeVotingStartTime"`
	MaybeVotingEndBlockHeight    *int64           `json:"maybeVotingEndBlockHeight"`
	MaybeVotingEndTime           *utctime.UTCTime `json:"maybeVotingEndTime"`
	Metadata                     *string          `json:"metadata"`
}

type ProposalWithMonikerRow

type ProposalWithMonikerRow struct {
	ProposalRow

	MaybeProposerMoniker *string `json:"maybeProposerMoniker"`
}

type Proposals

type Proposals interface {
	Insert(proposal *ProposalRow) error
	IncrementTotalVoteBy(proposalId uint64, voteToAdd *big.Int) error
	Update(row *ProposalRow) error
	FindById(proposalId string) (*ProposalWithMonikerRow, error)
	List(
		filter ProposalListFilter,
		order ProposalListOrder,
		pagination *pagination_interface.Pagination,
	) (
		[]ProposalWithMonikerRow,
		*pagination_interface.PaginationResult,
		error,
	)
}

func NewMockProposalsView

func NewMockProposalsView() Proposals

func NewProposalsView

func NewProposalsView(handle *rdb.Handle) Proposals

type ProposalsView

type ProposalsView struct {
	// contains filtered or unexported fields
}

func (*ProposalsView) FindById

func (proposalView *ProposalsView) FindById(proposalId string) (*ProposalWithMonikerRow, error)

func (*ProposalsView) IncrementTotalVoteBy

func (proposalView *ProposalsView) IncrementTotalVoteBy(proposalId uint64, voteToAdd *big.Int) error

func (*ProposalsView) Insert

func (proposalView *ProposalsView) Insert(proposal *ProposalRow) error

func (*ProposalsView) List

func (*ProposalsView) Update

func (proposalView *ProposalsView) Update(row *ProposalRow) error

type VoteHistory

type VoteHistory struct {
	TransactionHash   string          `json:"transactionHash"`
	VoteAtBlockHeight int64           `json:"voteAtBlockHeight"`
	VoteAtBlockTime   utctime.UTCTime `json:"voteAtBlockTime"`
	Answer            string          `json:"answer"`
	Metadata          string          `json:"metadata"`
	Weight            string          `json:"weight"`
}

type VoteListOrder

type VoteListOrder struct {
	VoteAtBlockHeight view.ORDER
}

type VoteRow

type VoteRow struct {
	ProposalId                string          `json:"proposalId"`
	VoterAddress              string          `json:"voterAddress"`
	MaybeVoterOperatorAddress *string         `json:"maybeVoterOperatorAddress"`
	TransactionHash           string          `json:"transactionHash"`
	VoteAtBlockHeight         int64           `json:"voteAtBlockHeight"`
	VoteAtBlockTime           utctime.UTCTime `json:"voteAtBlockTime"`
	Answer                    string          `json:"answer"`
	Histories                 []VoteHistory   `json:"histories"`
	Metadata                  string          `json:"metadata"`
	Weight                    string          `json:"weight"`
}

type VoteWithMonikerRow

type VoteWithMonikerRow struct {
	VoteRow

	MaybeVoterMoniker *string `json:"maybe_voter_moniker"`
}

type Votes

type Votes interface {
	Insert(row *VoteRow) error
	FindByProposalIdVoter(
		proposalId string,
		voterAddress string,
	) ([]VoteWithMonikerRow, error)
	ListByProposalId(
		proposalId string,
		order VoteListOrder,
		pagination *pagination.Pagination,
	) ([]VoteWithMonikerRow, *pagination.PaginationResult, error)
	DeleteByProposalIdVoter(
		proposalId string,
		voterAddress string,
	) (int64, error)
}

func NewMockVotesView

func NewMockVotesView() Votes

func NewVotesView

func NewVotesView(handle *rdb.Handle) Votes

type VotesTotal

type VotesTotal interface {
	Set(string, int64) error
	Increment(string, int64) error
	IncrementAll([]string, int64) error
	DecrementAll([]string, int64) error
	FindBy(string) (int64, error)
	SumBy([]string) (int64, error)
}

func NewMockVotesTotalView

func NewMockVotesTotalView(_ *rdb.Handle) VotesTotal

func NewVotesTotalView

func NewVotesTotalView(rdbHandle *rdb.Handle) VotesTotal

type VotesTotalView

type VotesTotalView struct {
	*view.Total
}

type VotesView

type VotesView struct {
	// contains filtered or unexported fields
}

func (*VotesView) DeleteByProposalIdVoter added in v1.7.0

func (votesView *VotesView) DeleteByProposalIdVoter(proposalId string, voterAddress string) (int64, error)

func (*VotesView) FindByProposalIdVoter

func (votesView *VotesView) FindByProposalIdVoter(proposalId string, voterAddress string) ([]VoteWithMonikerRow, error)

func (*VotesView) Insert

func (votesView *VotesView) Insert(row *VoteRow) error

func (*VotesView) ListByProposalId

func (votesView *VotesView) ListByProposalId(
	proposalId string,
	order VoteListOrder,
	pagination *pagination.Pagination,
) ([]VoteWithMonikerRow, *pagination.PaginationResult, error)

Jump to

Keyboard shortcuts

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