politeia

package
v4.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package politeia manages Politeia proposals and the voting that is coordinated by the Politeia server and anchored on the blockchain.

Index

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.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

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.

Directories

Path Synopsis
Package piclient handles the http requests made to Politeia APIs.
Package piclient handles the http requests made to Politeia APIs.

Jump to

Keyboard shortcuts

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