Documentation ¶
Overview ¶
Package politeia manages Politeia proposals and the voting that is coordinated by the Politeia server and anchored on the blockchain.
Index ¶
- func DisableLog()
- func UseLogger(logger slog.Logger)
- type ProposalDB
- func (db *ProposalDB) AllProposals(offset, rowsCount int, filterByVoteStatus ...int) (proposals []*pitypes.ProposalInfo, totalCount int, err error)
- func (db *ProposalDB) CheckProposalsUpdates() error
- func (db *ProposalDB) Close() error
- func (db *ProposalDB) ProposalByID(proposalID int) (proposal *pitypes.ProposalInfo, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
Types ¶
type ProposalDB ¶
type ProposalDB struct { APIURLpath string // contains filtered or unexported fields }
ProposalDB defines the common data needed to query the proposals db.
func NewProposalsDB ¶
func NewProposalsDB(politeiaURL, dbPath string) (*ProposalDB, error)
NewProposalsDB opens an exiting database or creates a new DB instance with the provided file name. Returns an initialized instance of proposals DB, http client and the formatted politeia API URL path to be used.
func (*ProposalDB) AllProposals ¶
func (db *ProposalDB) AllProposals(offset, rowsCount int, filterByVoteStatus ...int) (proposals []*pitypes.ProposalInfo, totalCount int, err error)
AllProposals fetches all the proposals data saved to the db.
func (*ProposalDB) CheckProposalsUpdates ¶
func (db *ProposalDB) CheckProposalsUpdates() error
CheckProposalsUpdates updates the proposal changes if they exist and updates them to the proposal db.
func (*ProposalDB) Close ¶
func (db *ProposalDB) Close() error
Close closes the proposal DB instance created passed if it not nil.
func (*ProposalDB) ProposalByID ¶
func (db *ProposalDB) ProposalByID(proposalID int) (proposal *pitypes.ProposalInfo, err error)
ProposalByID returns the single proposal identified by the provided id.