Documentation ¶
Index ¶
- Constants
- Variables
- func NewRaw(connStr string) (*gorm.DB, error)
- type AddressesStore
- type AssetsStore
- func (s AssetsStore) Create(asset *model.Asset) error
- func (s AssetsStore) Get(assetID string) (*model.Asset, error)
- func (s AssetsStore) GetAll() ([]model.Asset, error)
- func (s AssetsStore) GetByType(assetType string) ([]model.Asset, error)
- func (s AssetsStore) GetTransactionsCount(assetID string) (*int, error)
- type BlocksSearch
- type DB
- type DelegationsSearch
- type DelegatorsStore
- type EventSearchInput
- type EventsStore
- type GetRawMessagesInput
- type NetworksStore
- type PlatformStore
- func (s *PlatformStore) Chains() ([]model.Chain, error)
- func (s *PlatformStore) CreateBlock(block *model.Block) error
- func (s *PlatformStore) CreateChain(chain *model.Chain) error
- func (s PlatformStore) CreateEvmReceipt(receipt *model.EvmReceipt) error
- func (s *PlatformStore) CreateEvmTrace(trace *model.EvmTrace) error
- func (s *PlatformStore) CreateRewardsOwner(owner *model.RewardsOwner) error
- func (s *PlatformStore) CreateTransaction(tx *model.Transaction) error
- func (s *PlatformStore) CreateTxInputs(ids []string, txID string) error
- func (s *PlatformStore) CreateTxOutputs(outputs []model.Output) error
- func (s *PlatformStore) GetBlock(hash string) (*model.Block, error)
- func (s *PlatformStore) GetBlocks(search *BlocksSearch) ([]model.Block, error)
- func (s *PlatformStore) GetChain(chainID string) (*model.Chain, error)
- func (s *PlatformStore) GetChainByName(name string) (*model.Chain, error)
- func (s *PlatformStore) GetEvmReceipt(txID string) (*model.EvmReceipt, error)
- func (s *PlatformStore) GetEvmTrace(id string) (*model.EvmTrace, error)
- func (s *PlatformStore) GetSyncStatus(chain string) (*model.SyncStatus, error)
- func (s *PlatformStore) GetSyncStatuses() ([]model.SyncStatus, error)
- func (s *PlatformStore) GetTransactionOutput(id string) (*model.Output, error)
- func (s *PlatformStore) LastBlock(chain string) (*model.Block, error)
- func (s *PlatformStore) MarkOutputsSpent(ids []string, txID string, txTime time.Time) error
- func (s *PlatformStore) UpdateSyncStatus(status *model.SyncStatus) error
- type RawMessagesStore
- func (s RawMessagesStore) CreateMessage(topic int, data []byte, timestamp time.Time) error
- func (s RawMessagesStore) CreateOrFindTopic(chain, name, vm string) (*model.RawMessageTopic, error)
- func (s RawMessagesStore) GetMessage(id int) (*model.RawMessage, error)
- func (s RawMessagesStore) GetMessages(input GetRawMessagesInput) ([]model.RawMessage, error)
- func (s RawMessagesStore) GetTopicByChain(chain string) (*model.RawMessageTopic, error)
- func (s RawMessagesStore) GetTopics() ([]model.RawMessageTopic, error)
- func (s RawMessagesStore) LastProcessedID(topic int) (int, error)
- func (s RawMessagesStore) MarkMessageProcessed(message *model.RawMessage) error
- type Row
- type RowFunc
- type TransactionsStore
- func (store TransactionsStore) GetByID(id string) (*model.Transaction, error)
- func (store TransactionsStore) GetShortByID(id string) (*model.Transaction, error)
- func (s TransactionsStore) GetTypeCounts(chain string) ([]model.TransactionTypeCount, error)
- func (store TransactionsStore) Search(input *TxSearchInput) (*TxSearchOutput, error)
- type TxSearchInput
- type TxSearchOutput
- type ValidatorsSearch
- type ValidatorsStore
- func (s ValidatorsStore) CreateStats(t time.Time, bucket string) error
- func (s ValidatorsStore) FindByNodeID(id string) (*model.Validator, error)
- func (s ValidatorsStore) GetStats(id string, bucket string, limit int) ([]model.ValidatorStat, error)
- func (s ValidatorsStore) Import(records []model.Validator) error
- func (s ValidatorsStore) ImportSeq(records []model.ValidatorSeq) error
- func (s ValidatorsStore) LastHeight() (int64, error)
- func (s ValidatorsStore) LastTime() (*time.Time, error)
- func (s ValidatorsStore) PurgeSeq(before time.Time) (int64, error)
- func (s ValidatorsStore) Search(search ValidatorsSearch) ([]model.Validator, error)
Constants ¶
const (
DelegationsBatchSize = 1000 // max number of delegations to import per batch
)
Variables ¶
var ErrNotFound = gorm.ErrRecordNotFound
Functions ¶
Types ¶
type AddressesStore ¶
type AssetsStore ¶ added in v0.3.0
func (AssetsStore) Get ¶ added in v0.3.0
func (s AssetsStore) Get(assetID string) (*model.Asset, error)
func (AssetsStore) GetByType ¶ added in v0.3.0
func (s AssetsStore) GetByType(assetType string) ([]model.Asset, error)
func (AssetsStore) GetTransactionsCount ¶ added in v0.3.0
func (s AssetsStore) GetTransactionsCount(assetID string) (*int, error)
type BlocksSearch ¶ added in v0.3.0
type BlocksSearch struct { Chain string `form:"chain"` Type string `form:"type"` StartHeight int `form:"start_height"` EndHeight int `form:"end_height"` Order string `form:"order"` Limit int `form:"limit"` Offset int `form:"offset"` Page int `form:"page"` }
func (*BlocksSearch) Validate ¶ added in v0.3.0
func (s *BlocksSearch) Validate() error
type DB ¶
type DB struct { Addresses AddressesStore Validators ValidatorsStore Delegators DelegatorsStore Networks NetworksStore Platform PlatformStore RawMessages RawMessagesStore Transactions TransactionsStore Assets AssetsStore Events EventsStore // contains filtered or unexported fields }
func (DB) ResetTableSeqCounters ¶
type DelegationsSearch ¶ added in v0.2.1
type DelegatorsStore ¶
func (DelegatorsStore) Import ¶
func (s DelegatorsStore) Import(records []model.Delegation, batchSize int) error
Import imports delegations records in bulk
func (DelegatorsStore) Search ¶ added in v0.2.1
func (s DelegatorsStore) Search(search DelegationsSearch) ([]model.Delegation, error)
Search performs a seach on delegations
type EventSearchInput ¶ added in v0.4.0
type EventSearchInput struct { Type string `form:"type"` Scope string `form:"scope"` Chain string `form:"chain"` ItemID string `form:"item_id"` ItemType string `form:"item_type"` StartTime string `form:"start_time"` EndTime string `form:"end_time"` StartHeight int `form:"start_height"` EndHeight int `form:"end_height"` Limit int `form:"limit"` Offset int `form:"offset"` Page int `form:"page"` // contains filtered or unexported fields }
func (*EventSearchInput) Validate ¶ added in v0.4.0
func (input *EventSearchInput) Validate() error
type EventsStore ¶ added in v0.4.0
func NewEventsStore ¶ added in v0.4.0
func NewEventsStore(db *gorm.DB) EventsStore
func (EventsStore) Create ¶ added in v0.4.0
func (s EventsStore) Create(event *model.Event) error
Create creates a new event record or ignores if it already exists
func (EventsStore) FindByID ¶ added in v0.4.0
func (s EventsStore) FindByID(id string) (*model.Event, error)
FindByID returns an event by ID
func (EventsStore) Search ¶ added in v0.4.0
func (s EventsStore) Search(input *EventSearchInput) ([]model.Event, error)
Search returns event records matching the search input
type GetRawMessagesInput ¶ added in v0.3.0
type NetworksStore ¶
func (NetworksStore) CreateMetric ¶
func (s NetworksStore) CreateMetric(record *model.NetworkMetric) error
CreateMetric creates a new network metric record
func (NetworksStore) CreateStats ¶
func (s NetworksStore) CreateStats(t time.Time, bucket string) error
CreateStats creates a stat for a given time bucket
func (NetworksStore) GetStats ¶
func (s NetworksStore) GetStats(bucket string, limit int) ([]model.NetworkStat, error)
GetStats returns a set of stats for a given time bucket
type PlatformStore ¶ added in v0.3.0
func NewPlatformStore ¶ added in v0.3.0
func NewPlatformStore(db *gorm.DB) PlatformStore
func (*PlatformStore) Chains ¶ added in v0.3.0
func (s *PlatformStore) Chains() ([]model.Chain, error)
Chains returns all existing chain records
func (*PlatformStore) CreateBlock ¶ added in v0.3.0
func (s *PlatformStore) CreateBlock(block *model.Block) error
CreateBlock creates a new block
func (*PlatformStore) CreateChain ¶ added in v0.3.0
func (s *PlatformStore) CreateChain(chain *model.Chain) error
CreateChain creates a new chain record
func (PlatformStore) CreateEvmReceipt ¶ added in v0.6.0
func (s PlatformStore) CreateEvmReceipt(receipt *model.EvmReceipt) error
CreateEvmReceipt creates a new receipt record
func (*PlatformStore) CreateEvmTrace ¶ added in v0.6.0
func (s *PlatformStore) CreateEvmTrace(trace *model.EvmTrace) error
CreateEvmTrace creates a new evm trace record
func (*PlatformStore) CreateRewardsOwner ¶ added in v0.3.0
func (s *PlatformStore) CreateRewardsOwner(owner *model.RewardsOwner) error
CreateRewardsOwner creates rewards owner records
func (*PlatformStore) CreateTransaction ¶ added in v0.3.0
func (s *PlatformStore) CreateTransaction(tx *model.Transaction) error
CreateTransaction creates a new transaction
func (*PlatformStore) CreateTxInputs ¶ added in v0.3.0
func (s *PlatformStore) CreateTxInputs(ids []string, txID string) error
CreateTxInputs creates transaction input records
func (*PlatformStore) CreateTxOutputs ¶ added in v0.3.0
func (s *PlatformStore) CreateTxOutputs(outputs []model.Output) error
CreateTxOutputs create transaction output records
func (*PlatformStore) GetBlock ¶ added in v0.3.0
func (s *PlatformStore) GetBlock(hash string) (*model.Block, error)
GetBlock returns a single block by hash
func (*PlatformStore) GetBlocks ¶ added in v0.3.0
func (s *PlatformStore) GetBlocks(search *BlocksSearch) ([]model.Block, error)
GetBlocks returns blocks matching the search query
func (*PlatformStore) GetChain ¶ added in v0.3.0
func (s *PlatformStore) GetChain(chainID string) (*model.Chain, error)
GetChain returns a single chain record by ID
func (*PlatformStore) GetChainByName ¶ added in v0.4.0
func (s *PlatformStore) GetChainByName(name string) (*model.Chain, error)
GetChain returns a single chain record by name
func (*PlatformStore) GetEvmReceipt ¶ added in v0.6.0
func (s *PlatformStore) GetEvmReceipt(txID string) (*model.EvmReceipt, error)
GetEvmReceipt returns a receipt record by transaction ID
func (*PlatformStore) GetEvmTrace ¶ added in v0.6.0
func (s *PlatformStore) GetEvmTrace(id string) (*model.EvmTrace, error)
GetEvmTrace returns the trace record by transaction ID
func (*PlatformStore) GetSyncStatus ¶ added in v0.3.0
func (s *PlatformStore) GetSyncStatus(chain string) (*model.SyncStatus, error)
GetSyncStatus returns the chain sync status record
func (*PlatformStore) GetSyncStatuses ¶ added in v0.3.0
func (s *PlatformStore) GetSyncStatuses() ([]model.SyncStatus, error)
GetSyncStatuses returns all sync status records
func (*PlatformStore) GetTransactionOutput ¶ added in v0.3.0
func (s *PlatformStore) GetTransactionOutput(id string) (*model.Output, error)
GetTransactionOutput returns a single output record
func (*PlatformStore) LastBlock ¶ added in v0.4.0
func (s *PlatformStore) LastBlock(chain string) (*model.Block, error)
LastBlock returns a block for the latest height
func (*PlatformStore) MarkOutputsSpent ¶ added in v0.3.0
MarkOutputsSpent updates the spent transaction reference on outputs
func (*PlatformStore) UpdateSyncStatus ¶ added in v0.3.0
func (s *PlatformStore) UpdateSyncStatus(status *model.SyncStatus) error
UpdateSyncStatus creates or updates an sync status record
type RawMessagesStore ¶ added in v0.3.0
func (RawMessagesStore) CreateMessage ¶ added in v0.3.0
func (RawMessagesStore) CreateOrFindTopic ¶ added in v0.3.0
func (s RawMessagesStore) CreateOrFindTopic(chain, name, vm string) (*model.RawMessageTopic, error)
func (RawMessagesStore) GetMessage ¶ added in v0.3.0
func (s RawMessagesStore) GetMessage(id int) (*model.RawMessage, error)
func (RawMessagesStore) GetMessages ¶ added in v0.3.0
func (s RawMessagesStore) GetMessages(input GetRawMessagesInput) ([]model.RawMessage, error)
func (RawMessagesStore) GetTopicByChain ¶ added in v0.3.0
func (s RawMessagesStore) GetTopicByChain(chain string) (*model.RawMessageTopic, error)
func (RawMessagesStore) GetTopics ¶ added in v0.3.0
func (s RawMessagesStore) GetTopics() ([]model.RawMessageTopic, error)
func (RawMessagesStore) LastProcessedID ¶ added in v0.3.0
func (s RawMessagesStore) LastProcessedID(topic int) (int, error)
func (RawMessagesStore) MarkMessageProcessed ¶ added in v0.3.0
func (s RawMessagesStore) MarkMessageProcessed(message *model.RawMessage) error
type TransactionsStore ¶ added in v0.3.0
func (TransactionsStore) GetByID ¶ added in v0.3.0
func (store TransactionsStore) GetByID(id string) (*model.Transaction, error)
GetByID returns transaction by ID
func (TransactionsStore) GetShortByID ¶ added in v0.6.0
func (store TransactionsStore) GetShortByID(id string) (*model.Transaction, error)
GetShortByID returns just the transaction record without any extra data
func (TransactionsStore) GetTypeCounts ¶ added in v0.3.0
func (s TransactionsStore) GetTypeCounts(chain string) ([]model.TransactionTypeCount, error)
GetTypeCounts returns transaction types with counts
func (TransactionsStore) Search ¶ added in v0.3.0
func (store TransactionsStore) Search(input *TxSearchInput) (*TxSearchOutput, error)
Search returns transactions matching search input
type TxSearchInput ¶ added in v0.3.0
type TxSearchInput struct { Chain string `form:"chain"` Type string `form:"type"` Address string `form:"address"` Asset string `form:"asset"` Memo string `form:"memo"` Order string `form:"order"` Limit int `form:"limit"` Offset int `form:"offset"` Page int `form:"page"` StartTime string `form:"start_time"` EndTime string `form:"end_time"` StartHeight int `form:"start_height"` EndHeight int `form:"end_height"` BlockHash string `form:"block_hash"` BeforeID string `form:"before_id"` AfterID string `form:"after_id"` // contains filtered or unexported fields }
func (*TxSearchInput) Validate ¶ added in v0.3.0
func (input *TxSearchInput) Validate() error
type TxSearchOutput ¶ added in v0.3.0
type TxSearchOutput struct {
Transactions []model.Transaction `json:"data"`
}
type ValidatorsSearch ¶ added in v0.2.1
type ValidatorsSearch struct { RewardAddress string `form:"reward_address"` CapacityPercentMin uint `form:"capacity_percent_min"` CapacityPercentMax uint `form:"capacity_percent_max"` }
func (ValidatorsSearch) Validate ¶ added in v0.2.1
func (s ValidatorsSearch) Validate() error
type ValidatorsStore ¶
func (ValidatorsStore) CreateStats ¶
func (s ValidatorsStore) CreateStats(t time.Time, bucket string) error
func (ValidatorsStore) FindByNodeID ¶
func (s ValidatorsStore) FindByNodeID(id string) (*model.Validator, error)
func (ValidatorsStore) GetStats ¶
func (s ValidatorsStore) GetStats(id string, bucket string, limit int) ([]model.ValidatorStat, error)
func (ValidatorsStore) ImportSeq ¶
func (s ValidatorsStore) ImportSeq(records []model.ValidatorSeq) error
func (ValidatorsStore) LastHeight ¶
func (s ValidatorsStore) LastHeight() (int64, error)
func (ValidatorsStore) LastTime ¶ added in v0.2.1
func (s ValidatorsStore) LastTime() (*time.Time, error)
func (ValidatorsStore) PurgeSeq ¶
func (s ValidatorsStore) PurgeSeq(before time.Time) (int64, error)
func (ValidatorsStore) Search ¶ added in v0.2.1
func (s ValidatorsStore) Search(search ValidatorsSearch) ([]model.Validator, error)