Documentation ¶
Index ¶
- Constants
- Variables
- type AccountsStore
- func (s AccountsStore) All() ([]model.Account, error)
- func (s AccountsStore) AllByDelegator(account string) ([]model.Account, error)
- func (s AccountsStore) ByHeight(height int64) ([]model.Account, error)
- func (s AccountsStore) Count() (int, error)
- func (s AccountsStore) Create(record interface{}) error
- func (s AccountsStore) CreateOrUpdate(acc *model.Account) error
- func (s AccountsStore) DeleteByHeight(height int64) error
- func (s AccountsStore) FindBy(key string, value interface{}) (*model.Account, error)
- func (s AccountsStore) FindByID(id int64) (*model.Account, error)
- func (s AccountsStore) FindByPublicKey(key string) (*model.Account, error)
- func (s AccountsStore) Import(records []model.Account) error
- func (s AccountsStore) Truncate() error
- func (s AccountsStore) Update(record interface{}) error
- type BlockSearch
- type BlocksStore
- func (s BlocksStore) AvgTimes(limit int64) ([]byte, error)
- func (s BlocksStore) Create(record interface{}) error
- func (s BlocksStore) CreateIfNotExists(block *model.Block) error
- func (s BlocksStore) DeleteByHeight(height int64) error
- func (s BlocksStore) FindBy(key string, value interface{}) (*model.Block, error)
- func (s BlocksStore) FindByHash(hash string) (*model.Block, error)
- func (s BlocksStore) FindByHeight(height uint64) (*model.Block, error)
- func (s BlocksStore) FindByID(id int64) (*model.Block, error)
- func (s BlocksStore) PickExisting(hashes []string) (result []string, err error)
- func (s BlocksStore) Recent() (*model.Block, error)
- func (s BlocksStore) Search(search BlockSearch) ([]model.Block, error)
- func (s BlocksStore) Stats(period uint, interval string) ([]byte, error)
- func (s BlocksStore) Truncate() error
- func (s BlocksStore) Update(record interface{}) error
- type FeeTransfersStore
- func (s FeeTransfersStore) Create(record interface{}) error
- func (s FeeTransfersStore) DeleteByHeight(height int64) error
- func (s FeeTransfersStore) FindByHeight(height uint64) (result []model.FeeTransfer, err error)
- func (s FeeTransfersStore) Import(records []model.FeeTransfer) error
- func (s FeeTransfersStore) Truncate() error
- func (s FeeTransfersStore) Update(record interface{}) error
- type HeightsStore
- func (s HeightsStore) Create(record interface{}) error
- func (s HeightsStore) DeleteByHeight(height int64) error
- func (s HeightsStore) Last() (*model.Height, error)
- func (s HeightsStore) LastSuccessful() (*model.Height, error)
- func (s HeightsStore) StatusCounts() ([]model.HeightStatusCount, error)
- func (s HeightsStore) Truncate() error
- func (s HeightsStore) Update(record interface{}) error
- type JobsStore
- func (s JobsStore) ByHeight(height uint64) ([]model.Job, error)
- func (s JobsStore) Create(record interface{}) error
- func (s JobsStore) DeleteByHeight(height int64) error
- func (s JobsStore) Import(jobs []model.Job) error
- func (s JobsStore) Truncate() error
- func (s JobsStore) Update(record interface{}) error
- type SnarkersStore
- func (s SnarkersStore) All() ([]model.Snarker, error)
- func (s SnarkersStore) Create(record interface{}) error
- func (s SnarkersStore) DeleteByHeight(height int64) error
- func (s SnarkersStore) Import(records []model.Snarker) error
- func (s SnarkersStore) Truncate() error
- func (s SnarkersStore) Update(record interface{}) error
- type StatsStore
- func (s StatsStore) Create(record interface{}) error
- func (s StatsStore) CreateChainStats(bucket string, ts time.Time) error
- func (s StatsStore) CreateTransactionsStats(bucket string, ts time.Time) error
- func (s StatsStore) CreateValidatorStats(validator *model.Validator, bucket string, ts time.Time) error
- func (s StatsStore) DeleteByHeight(height int64) error
- func (s StatsStore) TransactionsStats(period uint, interval string) ([]byte, error)
- func (s StatsStore) Truncate() error
- func (s StatsStore) Update(record interface{}) error
- func (s StatsStore) ValidatorStats(validator *model.Validator, period uint, interval string) ([]model.ValidatorStat, error)
- type Store
- type TransactionSearch
- type TransactionsStore
- func (s TransactionsStore) ByAccount(account string) ([]model.Transaction, error)
- func (s TransactionsStore) ByHeight(height uint64) ([]model.Transaction, error)
- func (s TransactionsStore) Create(record interface{}) error
- func (s TransactionsStore) CreateIfNotExists(t *model.Transaction) error
- func (s TransactionsStore) DeleteByHeight(height int64) error
- func (s TransactionsStore) FindBy(key string, value interface{}) (*model.Transaction, error)
- func (s TransactionsStore) FindByHash(hash string) (*model.Transaction, error)
- func (s TransactionsStore) FindByID(id int64) (*model.Transaction, error)
- func (s TransactionsStore) Search(search TransactionSearch) ([]model.Transaction, error)
- func (s TransactionsStore) Truncate() error
- func (s TransactionsStore) Types() ([]byte, error)
- func (s TransactionsStore) Update(record interface{}) error
- type ValidatorsStore
- func (s ValidatorsStore) Create(record interface{}) error
- func (s ValidatorsStore) CreateIfNotExists(validator *model.Validator) error
- func (s ValidatorsStore) DeleteByHeight(height int64) error
- func (s ValidatorsStore) FindAll() (result []model.Validator, err error)
- func (s ValidatorsStore) FindByAccount(key string) (*model.Validator, error)
- func (s ValidatorsStore) Import(records []model.Validator) error
- func (s ValidatorsStore) Index() ([]byte, error)
- func (s ValidatorsStore) Truncate() error
- func (s ValidatorsStore) Update(record interface{}) error
Constants ¶
const ( BucketHour = "h" BucketDay = "d" )
Variables ¶
var (
ErrNotFound = errors.New("record not found")
)
Functions ¶
This section is empty.
Types ¶
type AccountsStore ¶
type AccountsStore struct {
// contains filtered or unexported fields
}
AccountsStore handles operations on accounts
func NewAccountsStore ¶
func NewAccountsStore(db *gorm.DB) AccountsStore
func (AccountsStore) All ¶
func (s AccountsStore) All() ([]model.Account, error)
All returns all accounts
func (AccountsStore) AllByDelegator ¶
func (s AccountsStore) AllByDelegator(account string) ([]model.Account, error)
AllByDelegator returns all accounts delegated to another account
func (AccountsStore) ByHeight ¶
func (s AccountsStore) ByHeight(height int64) ([]model.Account, error)
ByHeight returns all accounts that were created at a given height
func (AccountsStore) Count ¶
func (s AccountsStore) Count() (int, error)
func (AccountsStore) Create ¶
func (s AccountsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (AccountsStore) CreateOrUpdate ¶
func (s AccountsStore) CreateOrUpdate(acc *model.Account) error
CreateOrUpdate creates a new account or updates an existing one
func (AccountsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (AccountsStore) FindBy ¶
func (s AccountsStore) FindBy(key string, value interface{}) (*model.Account, error)
FindBy returns an account for a matching attribute
func (AccountsStore) FindByID ¶
func (s AccountsStore) FindByID(id int64) (*model.Account, error)
FindByID returns an account for the ID
func (AccountsStore) FindByPublicKey ¶
func (s AccountsStore) FindByPublicKey(key string) (*model.Account, error)
FindByPublicKey returns an account for the public key
type BlockSearch ¶
type BlockSearch struct { Creator string `form:"creator"` Order string `form:"order"` OrderColumn string `form:"order_column"` Limit int `form:"limit"` }
BlockSearch contains a block search params
type BlocksStore ¶
type BlocksStore struct {
// contains filtered or unexported fields
}
BlocksStore handles operations on blocks
func NewBlocksStore ¶
func NewBlocksStore(db *gorm.DB) BlocksStore
func (BlocksStore) AvgTimes ¶
func (s BlocksStore) AvgTimes(limit int64) ([]byte, error)
AvgTimes returns recent blocks averages
func (BlocksStore) Create ¶
func (s BlocksStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (BlocksStore) CreateIfNotExists ¶
func (s BlocksStore) CreateIfNotExists(block *model.Block) error
CreateIfNotExists creates the block if it does not exist
func (BlocksStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (BlocksStore) FindBy ¶
func (s BlocksStore) FindBy(key string, value interface{}) (*model.Block, error)
FindBy returns a block for a matching attribute
func (BlocksStore) FindByHash ¶
func (s BlocksStore) FindByHash(hash string) (*model.Block, error)
FindByHash returns a block with the matching hash
func (BlocksStore) FindByHeight ¶
func (s BlocksStore) FindByHeight(height uint64) (*model.Block, error)
FindByHeight returns a block with the matching height
func (BlocksStore) FindByID ¶
func (s BlocksStore) FindByID(id int64) (*model.Block, error)
FindByID returns a block with matching ID
func (BlocksStore) PickExisting ¶
func (s BlocksStore) PickExisting(hashes []string) (result []string, err error)
func (BlocksStore) Recent ¶
func (s BlocksStore) Recent() (*model.Block, error)
Recent returns the most recent block
func (BlocksStore) Search ¶
func (s BlocksStore) Search(search BlockSearch) ([]model.Block, error)
Search returns blocks that match search filters
func (BlocksStore) Stats ¶
func (s BlocksStore) Stats(period uint, interval string) ([]byte, error)
Stats returns block stats for a given interval
type FeeTransfersStore ¶
type FeeTransfersStore struct {
// contains filtered or unexported fields
}
func NewFeeTransfersStore ¶
func NewFeeTransfersStore(db *gorm.DB) FeeTransfersStore
func (FeeTransfersStore) Create ¶
func (s FeeTransfersStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (FeeTransfersStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (FeeTransfersStore) FindByHeight ¶
func (s FeeTransfersStore) FindByHeight(height uint64) (result []model.FeeTransfer, err error)
func (FeeTransfersStore) Import ¶
func (s FeeTransfersStore) Import(records []model.FeeTransfer) error
type HeightsStore ¶
type HeightsStore struct {
// contains filtered or unexported fields
}
HeightsStore handles operations on heights
func NewHeightsStore ¶
func NewHeightsStore(db *gorm.DB) HeightsStore
func (HeightsStore) Create ¶
func (s HeightsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (HeightsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (HeightsStore) Last ¶
func (s HeightsStore) Last() (*model.Height, error)
Last returns a last height record
func (HeightsStore) LastSuccessful ¶
func (s HeightsStore) LastSuccessful() (*model.Height, error)
LastSuccessful returns the last successful height record
func (HeightsStore) StatusCounts ¶
func (s HeightsStore) StatusCounts() ([]model.HeightStatusCount, error)
StatusCounts returns height sync statuses with counts
type JobsStore ¶
type JobsStore struct {
// contains filtered or unexported fields
}
JobsStore handles operations on jobs
func NewJobsStore ¶
func (JobsStore) Create ¶
func (s JobsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (JobsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
type SnarkersStore ¶
type SnarkersStore struct {
// contains filtered or unexported fields
}
func NewSnarkersStore ¶
func NewSnarkersStore(db *gorm.DB) SnarkersStore
func (SnarkersStore) Create ¶
func (s SnarkersStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (SnarkersStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
type StatsStore ¶
type StatsStore struct {
// contains filtered or unexported fields
}
func NewStatsStore ¶
func NewStatsStore(db *gorm.DB) StatsStore
func (StatsStore) Create ¶
func (s StatsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (StatsStore) CreateChainStats ¶
func (s StatsStore) CreateChainStats(bucket string, ts time.Time) error
CreateChainStats creates a new chain stats record
func (StatsStore) CreateTransactionsStats ¶
func (s StatsStore) CreateTransactionsStats(bucket string, ts time.Time) error
CreateTransactionsStats creates a new transaction stats record
func (StatsStore) CreateValidatorStats ¶
func (s StatsStore) CreateValidatorStats(validator *model.Validator, bucket string, ts time.Time) error
CreateValidatorStats creates a new validator stats record
func (StatsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (StatsStore) TransactionsStats ¶
func (s StatsStore) TransactionsStats(period uint, interval string) ([]byte, error)
TransactionsStats returns transactions stats for a given timeframe
func (StatsStore) Truncate ¶
func (s StatsStore) Truncate() error
Truncate removes all records from the table
func (StatsStore) Update ¶
func (s StatsStore) Update(record interface{}) error
Update updates the existing record. Must pass a pointer.
func (StatsStore) ValidatorStats ¶
func (s StatsStore) ValidatorStats(validator *model.Validator, period uint, interval string) ([]model.ValidatorStat, error)
ValidatorStats returns validator stats for a given timeframe
type Store ¶
type Store struct { Heights HeightsStore Blocks BlocksStore Accounts AccountsStore Validators ValidatorsStore Transactions TransactionsStore Jobs JobsStore Snarkers SnarkersStore FeeTransfers FeeTransfersStore Stats StatsStore // contains filtered or unexported fields }
Store handles all database operations
func (*Store) SetDebugMode ¶
SetDebugMode enabled detailed query logging
type TransactionSearch ¶
type TransactionSearch struct { AfterID uint `form:"after_id"` BeforeID uint `form:"before_id"` Height uint64 `form:"height"` Type string `form:"type"` BlockHash string `form:"block_hash"` Account string `form:"account"` Sender string `form:"sender"` Receiver string `form:"receiver"` Memo string `form:"memo"` StartTime string `form:"start_time"` EndTime string `form:"end_time"` Limit uint `form:"limit"` // contains filtered or unexported fields }
TransactionSearch contains transaction search params
func (*TransactionSearch) Validate ¶
func (s *TransactionSearch) Validate() error
Validate returns an error if search form is invalid
type TransactionsStore ¶
type TransactionsStore struct {
// contains filtered or unexported fields
}
TransactionsStore handles operations on transactions
func NewTransactionsStore ¶
func NewTransactionsStore(db *gorm.DB) TransactionsStore
func (TransactionsStore) ByAccount ¶
func (s TransactionsStore) ByAccount(account string) ([]model.Transaction, error)
ByAccount returns a list of transactions sent or received by the account
func (TransactionsStore) ByHeight ¶
func (s TransactionsStore) ByHeight(height uint64) ([]model.Transaction, error)
ByHeight returns transactions for a given height
func (TransactionsStore) Create ¶
func (s TransactionsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (TransactionsStore) CreateIfNotExists ¶
func (s TransactionsStore) CreateIfNotExists(t *model.Transaction) error
CreateIfNotExists creates the transaction if it does not exist
func (TransactionsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (TransactionsStore) FindBy ¶
func (s TransactionsStore) FindBy(key string, value interface{}) (*model.Transaction, error)
FindBy returns transactions by a given key and value
func (TransactionsStore) FindByHash ¶
func (s TransactionsStore) FindByHash(hash string) (*model.Transaction, error)
FindByHash returns a transaction for a given hash
func (TransactionsStore) FindByID ¶
func (s TransactionsStore) FindByID(id int64) (*model.Transaction, error)
FindByID returns a transaction for a given ID
func (TransactionsStore) Search ¶
func (s TransactionsStore) Search(search TransactionSearch) ([]model.Transaction, error)
Search returns a list of transactions that matches the filters
func (TransactionsStore) Truncate ¶
func (s TransactionsStore) Truncate() error
Truncate removes all records from the table
func (TransactionsStore) Types ¶
func (s TransactionsStore) Types() ([]byte, error)
Types returns the list of available transactions types
type ValidatorsStore ¶
type ValidatorsStore struct {
// contains filtered or unexported fields
}
ValidatorsStore handles operations on validators
func NewValidatorsStore ¶
func NewValidatorsStore(db *gorm.DB) ValidatorsStore
func (ValidatorsStore) Create ¶
func (s ValidatorsStore) Create(record interface{}) error
Create creates a new record. Must pass a pointer.
func (ValidatorsStore) CreateIfNotExists ¶
func (s ValidatorsStore) CreateIfNotExists(validator *model.Validator) error
CreateIfNotExists creates the validator if it does not exist
func (ValidatorsStore) DeleteByHeight ¶
DeleteByHeight removes all records associated with a height
func (ValidatorsStore) FindAll ¶
func (s ValidatorsStore) FindAll() (result []model.Validator, err error)
FindAll returns all available validators
func (ValidatorsStore) FindByAccount ¶
func (s ValidatorsStore) FindByAccount(key string) (*model.Validator, error)
FindByAccount returns a validator record associated with a key
func (ValidatorsStore) Index ¶
func (s ValidatorsStore) Index() ([]byte, error)