Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyDataRetentionPolicies(config Config, log *logging.Logger) error
- func CreateConnectionPool(conf ConnectionConfig) (*pgxpool.Pool, error)
- func CursorPredicate(args []interface{}, cursor interface{}, ordering TableOrdering) (string, []interface{}, error)
- func FilterRewardsQuery(filter entities.RewardSummaryFilter) (string, []any, error)
- func GetAllTableNames(ctx context.Context, conn Connection) ([]string, error)
- func GetAtHeightUsingConnection(ctx context.Context, connection Connection, height int64) (entities.Block, error)
- func GetLastBlockUsingConnection(ctx context.Context, connection Connection) (*entities.Block, error)
- func GetOldestHistoryBlockUsingConnection(ctx context.Context, connection Connection) (entities.Block, error)
- func HasVegaSchema(ctx context.Context, conn Connection) (bool, error)
- func MigrateDownToSchemaVersion(log *logging.Logger, config Config, version int64, fs fs.FS) error
- func MigrateToLatestSchema(log *logging.Logger, config Config) error
- func MigrateUpToSchemaVersion(log *logging.Logger, config Config, version int64, fs fs.FS) error
- func PaginateQuery[T any, PT parserPtr[T]](query string, args []interface{}, ordering TableOrdering, ...) (string, []interface{}, error)
- func PaginateQueryWithoutOrderBy[T any, PT parserPtr[T]](query string, args []interface{}, ordering TableOrdering, ...) (string, []interface{}, error)
- func RecreateVegaDatabase(ctx context.Context, log *logging.Logger, connConfig ConnectionConfig) error
- func RevertToSchemaVersionZero(log *logging.Logger, config ConnectionConfig, fs fs.FS, verbose bool) error
- func SanitizeSql(sql string, args ...any) (output string, err error)
- func StartEmbeddedPostgres(log *logging.Logger, config Config, runtimeDir string, ...) (*embeddedpostgres.EmbeddedPostgres, error)
- func StructValueForColumn(obj any, colName string) (interface{}, error)
- func WipeDatabaseAndMigrateSchemaToLatestVersion(log *logging.Logger, config ConnectionConfig, fs fs.FS, verbose bool) error
- func WipeDatabaseAndMigrateSchemaToVersion(log *logging.Logger, config ConnectionConfig, version int64, fs fs.FS, ...) error
- type AccountSource
- type Accounts
- func (as *Accounts) Add(ctx context.Context, a *entities.Account) error
- func (as *Accounts) GetAll(ctx context.Context) ([]entities.Account, error)
- func (as *Accounts) GetBalancesByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.AccountBalance, error)
- func (as *Accounts) GetByID(ctx context.Context, accountID entities.AccountID) (entities.Account, error)
- func (as *Accounts) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Account, error)
- func (as *Accounts) Obtain(ctx context.Context, a *entities.Account) error
- func (as *Accounts) Query(ctx context.Context, filter entities.AccountFilter) ([]entities.Account, error)
- func (as *Accounts) QueryBalances(ctx context.Context, filter entities.AccountFilter, ...) ([]entities.AccountBalance, entities.PageInfo, error)
- type Assets
- func (as *Assets) Add(ctx context.Context, a entities.Asset) error
- func (as *Assets) GetAll(ctx context.Context) ([]entities.Asset, error)
- func (as *Assets) GetAllWithCursorPagination(ctx context.Context, pagination entities.CursorPagination) ([]entities.Asset, entities.PageInfo, error)
- func (as *Assets) GetByID(ctx context.Context, id string) (entities.Asset, error)
- func (as *Assets) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Asset, error)
- type Balances
- type Blocks
- func (bs *Blocks) Add(ctx context.Context, b entities.Block) error
- func (bs *Blocks) GetAll(ctx context.Context) ([]entities.Block, error)
- func (bs *Blocks) GetAtHeight(ctx context.Context, height int64) (entities.Block, error)
- func (bs *Blocks) GetLastBlock(ctx context.Context) (entities.Block, error)
- func (bs *Blocks) GetOldestHistoryBlock(ctx context.Context) (entities.Block, error)
- type Candles
- func (cs *Candles) CandleExists(ctx context.Context, candleID string) (bool, error)
- func (cs *Candles) GetCandleDataForTimeSpan(ctx context.Context, candleID string, from *time.Time, to *time.Time, ...) ([]entities.Candle, entities.PageInfo, error)
- func (cs *Candles) GetCandleIDForIntervalAndMarket(ctx context.Context, interval string, market string) (bool, string, error)
- func (cs *Candles) GetCandlesForMarket(ctx context.Context, market string) (map[string]string, error)
- type Chain
- type Checkpoints
- type ChunkInterval
- type ColumnOrdering
- type Compare
- type Config
- type Connection
- type ConnectionConfig
- type ConnectionRetryConfig
- type ConnectionSource
- func (s *ConnectionSource) AfterCommit(ctx context.Context, f func())
- func (s *ConnectionSource) Close()
- func (s *ConnectionSource) Commit(ctx context.Context) error
- func (s *ConnectionSource) Rollback(ctx context.Context) error
- func (s *ConnectionSource) WithConnection(ctx context.Context) (context.Context, error)
- func (s *ConnectionSource) WithTransaction(ctx context.Context) (context.Context, error)
- type CoreSnapshotData
- type CursorQueryParameter
- type CursorQueryParameters
- type DatanodeBlockSpan
- type Delegations
- func (ds *Delegations) Add(ctx context.Context, d entities.Delegation) error
- func (ds *Delegations) Get(ctx context.Context, partyIDHex *string, nodeIDHex *string, epochID *int64, ...) ([]entities.Delegation, entities.PageInfo, error)
- func (ds *Delegations) GetAll(ctx context.Context) ([]entities.Delegation, error)
- func (ds *Delegations) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Delegation, error)
- type Deposits
- func (d *Deposits) GetByID(ctx context.Context, depositID string) (entities.Deposit, error)
- func (d *Deposits) GetByParty(ctx context.Context, party string, openOnly bool, ...) ([]entities.Deposit, entities.PageInfo, error)
- func (d *Deposits) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Deposit, error)
- func (d *Deposits) Upsert(ctx context.Context, deposit *entities.Deposit) error
- type ERC20MultiSigSignerEvent
- func (m *ERC20MultiSigSignerEvent) Add(ctx context.Context, e *entities.ERC20MultiSigSignerEvent) error
- func (m *ERC20MultiSigSignerEvent) GetAddedByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.ERC20MultiSigSignerAddedEvent, error)
- func (m *ERC20MultiSigSignerEvent) GetAddedEvents(ctx context.Context, validatorID string, submitter string, epochID *int64, ...) ([]entities.ERC20MultiSigSignerEvent, entities.PageInfo, error)
- func (m *ERC20MultiSigSignerEvent) GetRemovedByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.ERC20MultiSigSignerRemovedEvent, error)
- func (m *ERC20MultiSigSignerEvent) GetRemovedEvents(ctx context.Context, validatorID string, submitter string, epochID *int64, ...) ([]entities.ERC20MultiSigSignerEvent, entities.PageInfo, error)
- type EmbeddedPostgresLog
- type Epochs
- type ErrInvalidCandleID
- type EthereumKeyRotations
- func (store *EthereumKeyRotations) Add(ctx context.Context, kr entities.EthereumKeyRotation) error
- func (store *EthereumKeyRotations) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.EthereumKeyRotation, error)
- func (store *EthereumKeyRotations) List(ctx context.Context, nodeID entities.NodeID, ...) ([]entities.EthereumKeyRotation, entities.PageInfo, error)
- type HypertableOverride
- type KeyRotations
- func (store *KeyRotations) GetAllPubKeyRotations(ctx context.Context, pagination entities.CursorPagination) ([]entities.KeyRotation, entities.PageInfo, error)
- func (store *KeyRotations) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.KeyRotation, error)
- func (store *KeyRotations) GetPubKeyRotationsPerNode(ctx context.Context, nodeID string, pagination entities.CursorPagination) ([]entities.KeyRotation, entities.PageInfo, error)
- func (store *KeyRotations) Upsert(ctx context.Context, kr *entities.KeyRotation) error
- type Ledger
- func (ls *Ledger) Add(le entities.LedgerEntry) error
- func (ls *Ledger) Export(ctx context.Context, partyID string, assetID *string, ...) error
- func (ls *Ledger) Flush(ctx context.Context) ([]entities.LedgerEntry, error)
- func (ls *Ledger) GetAll(ctx context.Context) ([]entities.LedgerEntry, error)
- func (ls *Ledger) GetByLedgerEntryTime(ctx context.Context, ledgerEntryTime time.Time) (entities.LedgerEntry, error)
- func (ls *Ledger) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.LedgerEntry, error)
- func (ls *Ledger) Query(ctx context.Context, filter *entities.LedgerEntryFilter, ...) (*[]entities.AggregatedLedgerEntry, entities.PageInfo, error)
- type LiquidityProvision
- func (lp *LiquidityProvision) Flush(ctx context.Context) error
- func (lp *LiquidityProvision) Get(ctx context.Context, partyID entities.PartyID, marketID entities.MarketID, ...) ([]entities.LiquidityProvision, entities.PageInfo, error)
- func (lp *LiquidityProvision) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.LiquidityProvision, error)
- func (lp *LiquidityProvision) ObserveLiquidityProvisions(ctx context.Context, retries int, market *string, party *string) (<-chan []entities.LiquidityProvision, uint64)
- func (lp *LiquidityProvision) Upsert(ctx context.Context, liquidityProvision entities.LiquidityProvision) error
- type ListBatcher
- type LogRotationConfig
- type MapBatcher
- type MarginLevels
- func (ml *MarginLevels) Add(marginLevel entities.MarginLevels) error
- func (ml *MarginLevels) Flush(ctx context.Context) ([]entities.MarginLevels, error)
- func (ml *MarginLevels) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.MarginLevels, error)
- func (ml *MarginLevels) GetMarginLevelsByIDWithCursorPagination(ctx context.Context, partyID, marketID string, ...) ([]entities.MarginLevels, entities.PageInfo, error)
- type MarketData
- func (md *MarketData) Add(data *entities.MarketData) error
- func (md *MarketData) Flush(ctx context.Context) ([]*entities.MarketData, error)
- func (md *MarketData) GetBetweenDatesByID(ctx context.Context, marketID string, start, end time.Time, ...) ([]entities.MarketData, entities.PageInfo, error)
- func (md *MarketData) GetFromDateByID(ctx context.Context, marketID string, start time.Time, ...) ([]entities.MarketData, entities.PageInfo, error)
- func (md *MarketData) GetMarketDataByID(ctx context.Context, marketID string) (entities.MarketData, error)
- func (md *MarketData) GetMarketsData(ctx context.Context) ([]entities.MarketData, error)
- func (md *MarketData) GetToDateByID(ctx context.Context, marketID string, end time.Time, ...) ([]entities.MarketData, entities.PageInfo, error)
- type Markets
- func (m *Markets) GetAllPaged(ctx context.Context, marketID string, pagination entities.CursorPagination, ...) ([]entities.Market, entities.PageInfo, error)
- func (m *Markets) GetByID(ctx context.Context, marketID string) (entities.Market, error)
- func (m *Markets) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Market, error)
- func (m *Markets) Upsert(ctx context.Context, market *entities.Market) error
- type NetworkLimits
- type NetworkParameters
- func (np *NetworkParameters) Add(ctx context.Context, r entities.NetworkParameter) error
- func (np *NetworkParameters) GetAll(ctx context.Context, pagination entities.CursorPagination) ([]entities.NetworkParameter, entities.PageInfo, error)
- func (np *NetworkParameters) GetByKey(ctx context.Context, key string) (entities.NetworkParameter, error)
- func (np *NetworkParameters) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.NetworkParameter, error)
- type Node
- func (store *Node) AddNodeAnnouncedEvent(ctx context.Context, nodeID string, vegatime time.Time, ...) error
- func (store *Node) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.NodeBasic, error)
- func (store *Node) GetNodeByID(ctx context.Context, nodeID string, epochSeq uint64) (entities.Node, error)
- func (store *Node) GetNodeData(ctx context.Context, epochSeq uint64) (entities.NodeData, error)
- func (store *Node) GetNodeTxHash(ctx context.Context, nodeID string, epochSeq uint64) (entities.Node, error)
- func (store *Node) GetNodes(ctx context.Context, epochSeq uint64, pagination entities.CursorPagination) ([]entities.Node, entities.PageInfo, error)
- func (store *Node) UpdateEthereumAddress(ctx context.Context, kr entities.EthereumKeyRotation) error
- func (store *Node) UpdatePublicKey(ctx context.Context, kr *entities.KeyRotation) error
- func (store *Node) UpsertNode(ctx context.Context, node *entities.Node) error
- func (store *Node) UpsertRanking(ctx context.Context, rs *entities.RankingScore, aux *entities.RankingScoreAux) error
- func (store *Node) UpsertScore(ctx context.Context, rs *entities.RewardScore, aux *entities.RewardScoreAux) error
- type Notary
- func (n *Notary) Add(ctx context.Context, ns *entities.NodeSignature) error
- func (n *Notary) GetByResourceID(ctx context.Context, id string, pagination entities.CursorPagination) ([]entities.NodeSignature, entities.PageInfo, error)
- func (n *Notary) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.NodeSignature, error)
- type OracleData
- func (od *OracleData) Add(ctx context.Context, oracleData *entities.OracleData) error
- func (od *OracleData) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.OracleData, error)
- func (od *OracleData) GetOracleDataBySpecID(ctx context.Context, id string, pagination entities.Pagination) ([]entities.OracleData, entities.PageInfo, error)
- func (od *OracleData) ListOracleData(ctx context.Context, pagination entities.Pagination) ([]entities.OracleData, entities.PageInfo, error)
- type OracleSpec
- func (os *OracleSpec) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.OracleSpec, error)
- func (os *OracleSpec) GetSpecByID(ctx context.Context, specID string) (*entities.OracleSpec, error)
- func (os *OracleSpec) GetSpecsWithCursorPagination(ctx context.Context, specID string, pagination entities.CursorPagination) ([]entities.OracleSpec, entities.PageInfo, error)
- func (os *OracleSpec) Upsert(ctx context.Context, spec *entities.OracleSpec) error
- type Orders
- func (os *Orders) Add(o entities.Order) error
- func (os *Orders) Flush(ctx context.Context) ([]entities.Order, error)
- func (os *Orders) GetAll(ctx context.Context) ([]entities.Order, error)
- func (os *Orders) GetByMarketAndID(ctx context.Context, marketIDstr string, orderIDs []string) ([]entities.Order, error)
- func (os *Orders) GetByReferencePaged(ctx context.Context, reference string, p entities.CursorPagination) ([]entities.Order, entities.PageInfo, error)
- func (os *Orders) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Order, error)
- func (os *Orders) GetLiveOrders(ctx context.Context) ([]entities.Order, error)
- func (os *Orders) GetOrder(ctx context.Context, orderIDStr string, version *int32) (entities.Order, error)
- func (os *Orders) ListOrderVersions(ctx context.Context, orderIDStr string, p entities.CursorPagination) ([]entities.Order, entities.PageInfo, error)
- func (os *Orders) ListOrders(ctx context.Context, p entities.CursorPagination, ...) ([]entities.Order, entities.PageInfo, error)
- type Parties
- func (ps *Parties) Add(ctx context.Context, p entities.Party) error
- func (ps *Parties) GetAll(ctx context.Context) ([]entities.Party, error)
- func (ps *Parties) GetAllPaged(ctx context.Context, partyID string, pagination entities.CursorPagination) ([]entities.Party, entities.PageInfo, error)
- func (ps *Parties) GetByID(ctx context.Context, id string) (entities.Party, error)
- func (ps *Parties) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Party, error)
- func (ps *Parties) Initialise(ctx context.Context)
- type Positions
- func (ps *Positions) Add(ctx context.Context, p entities.Position) error
- func (ps *Positions) Flush(ctx context.Context) ([]entities.Position, error)
- func (ps *Positions) GetAll(ctx context.Context) ([]entities.Position, error)
- func (ps *Positions) GetByMarket(ctx context.Context, marketID string) ([]entities.Position, error)
- func (ps *Positions) GetByMarketAndParties(ctx context.Context, marketIDRaw string, partyIDsRaw []string) ([]entities.Position, error)
- func (ps *Positions) GetByMarketAndParty(ctx context.Context, marketIDRaw string, partyIDRaw string) (entities.Position, error)
- func (ps *Positions) GetByParty(ctx context.Context, partyID string) ([]entities.Position, error)
- func (ps *Positions) GetByPartyConnection(ctx context.Context, partyIDRaw []string, marketIDRaw []string, ...) ([]entities.Position, entities.PageInfo, error)
- func (ps *Positions) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Position, error)
- type Proposals
- func (ps *Proposals) Add(ctx context.Context, p entities.Proposal) error
- func (ps *Proposals) Get(ctx context.Context, inState *entities.ProposalState, partyIDStr *string, ...) ([]entities.Proposal, entities.PageInfo, error)
- func (ps *Proposals) GetByID(ctx context.Context, id string) (entities.Proposal, error)
- func (ps *Proposals) GetByReference(ctx context.Context, ref string) (entities.Proposal, error)
- func (ps *Proposals) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Proposal, error)
- type ProtocolUpgradeProposals
- func (ps *ProtocolUpgradeProposals) Add(ctx context.Context, p entities.ProtocolUpgradeProposal) error
- func (ps *ProtocolUpgradeProposals) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.ProtocolUpgradeProposal, error)
- func (ps *ProtocolUpgradeProposals) List(ctx context.Context, status *entities.ProtocolUpgradeProposalStatus, ...) ([]entities.ProtocolUpgradeProposal, entities.PageInfo, error)
- type RetentionPeriod
- type RetentionPolicy
- type Rewards
- func (rs *Rewards) Add(ctx context.Context, r entities.Reward) error
- func (rs *Rewards) GetAll(ctx context.Context) ([]entities.Reward, error)
- func (rs *Rewards) GetByCursor(ctx context.Context, partyIDHex *string, assetIDHex *string, fromEpoch *uint64, ...) ([]entities.Reward, entities.PageInfo, error)
- func (rs *Rewards) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Reward, error)
- func (rs *Rewards) GetEpochSummaries(ctx context.Context, filter entities.RewardSummaryFilter, ...) ([]entities.EpochRewardSummary, entities.PageInfo, error)
- func (rs *Rewards) GetSummaries(ctx context.Context, partyIDHex *string, assetIDHex *string) ([]entities.RewardSummary, error)
- type RiskFactors
- type Sorting
- type StakeLinking
- type TableOrdering
- type Trades
- func (ts *Trades) Add(t *entities.Trade) error
- func (ts *Trades) Flush(ctx context.Context) ([]*entities.Trade, error)
- func (ts *Trades) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Trade, error)
- func (ts *Trades) GetLastTradeByMarket(ctx context.Context, market string) ([]entities.Trade, error)
- func (ts *Trades) List(ctx context.Context, marketIDs []entities.MarketID, ...) ([]entities.Trade, entities.PageInfo, error)
- type Transfers
- func (t *Transfers) GetAll(ctx context.Context, pagination entities.CursorPagination) ([]entities.Transfer, entities.PageInfo, error)
- func (t *Transfers) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Transfer, error)
- func (t *Transfers) GetTransfersFromAccount(ctx context.Context, accountID entities.AccountID, ...) ([]entities.Transfer, entities.PageInfo, error)
- func (t *Transfers) GetTransfersFromParty(ctx context.Context, partyID entities.PartyID, ...) ([]entities.Transfer, entities.PageInfo, error)
- func (t *Transfers) GetTransfersToAccount(ctx context.Context, accountID entities.AccountID, ...) ([]entities.Transfer, entities.PageInfo, error)
- func (t *Transfers) GetTransfersToOrFromParty(ctx context.Context, partyID entities.PartyID, ...) ([]entities.Transfer, entities.PageInfo, error)
- func (t *Transfers) GetTransfersToParty(ctx context.Context, partyID entities.PartyID, ...) ([]entities.Transfer, entities.PageInfo, error)
- func (t *Transfers) Upsert(ctx context.Context, transfer *entities.Transfer) error
- type Votes
- func (vs *Votes) Add(ctx context.Context, v entities.Vote) error
- func (vs *Votes) Get(ctx context.Context, proposalIDStr *string, partyIDStr *string, ...) ([]entities.Vote, error)
- func (vs *Votes) GetByParty(ctx context.Context, partyIDStr string) ([]entities.Vote, error)
- func (vs *Votes) GetByPartyConnection(ctx context.Context, partyIDStr string, pagination entities.CursorPagination) ([]entities.Vote, entities.PageInfo, error)
- func (vs *Votes) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Vote, error)
- func (vs *Votes) GetConnection(ctx context.Context, proposalIDStr, partyIDStr *string, ...) ([]entities.Vote, entities.PageInfo, error)
- func (vs *Votes) GetNoVotesForProposal(ctx context.Context, proposalIDStr string) ([]entities.Vote, error)
- func (vs *Votes) GetYesVotesForProposal(ctx context.Context, proposalIDStr string) ([]entities.Vote, error)
- type Withdrawals
- func (w *Withdrawals) GetByID(ctx context.Context, withdrawalID string) (entities.Withdrawal, error)
- func (w *Withdrawals) GetByParty(ctx context.Context, partyID string, openOnly bool, ...) ([]entities.Withdrawal, entities.PageInfo, error)
- func (w *Withdrawals) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Withdrawal, error)
- func (w *Withdrawals) Upsert(ctx context.Context, withdrawal *entities.Withdrawal) error
Constants ¶
const ( ASC Sorting = "ASC" DESC Sorting = "DESC" EQ Compare = "=" NE Compare = "!=" GT Compare = ">" LT Compare = "<" GE Compare = ">=" LE Compare = "<=" )
const ( SQLMigrationsDir = "migrations" InfiniteInterval = "forever" )
const (
OrdersTableName = "orders"
)
Variables ¶
var ( ErrBlockWaitTimedout = errors.New("Timed out waiting for TimeUpdate event") BlockWaitTimeout = 5 * time.Second )
var ( ErrLedgerEntryFilterForParty = errors.New("filtering ledger entries should be limited to a single party") ErrLedgerEntryExportForParty = errors.New("exporting ledger entries should be limited to a single party") ErrLedgerEntryExportForAsset = errors.New("exporting ledger entries should be limited to a single asset") )
var EmbedMigrations embed.FS
var ErrBadID = errors.New("bad id (must be hex string)")
var ErrInvalidDateRange = errors.New("invalid date range, end date must be after start date")
Functions ¶
func CreateConnectionPool ¶ added in v0.67.0
func CreateConnectionPool(conf ConnectionConfig) (*pgxpool.Pool, error)
func CursorPredicate ¶
func CursorPredicate(args []interface{}, cursor interface{}, ordering TableOrdering) (string, []interface{}, error)
CursorPredicate generates an SQL predicate which excludes all rows before the supplied cursor, with regards to the supplied table ordering. The values used for comparison are added to the args list and bind variables used in the query fragment.
For example, with if you had a query with columns sorted foo ASCENDING, bar DESCENDING and a cursor with {foo=1, bar=2}, it would yield a string predicate like this:
(foo > $1) OR (foo = $1 AND bar <= $2)
And 'args' would have 1 and 2 appended to it.
Notes:
- The predicate *includes* the value at the cursor
- Only fields that are present in both the cursor and the ordering are considered
- The union of those fields must have enough information to uniquely identify a row
- The table ordering must be sufficient to ensure that a row identified by a cursor cannot change position in relation to the other rows
func FilterRewardsQuery ¶ added in v0.68.0
func FilterRewardsQuery(filter entities.RewardSummaryFilter) (string, []any, error)
FilterRewardsQuery returns a WHERE part of the query and args for filtering the rewards table.
func GetAllTableNames ¶ added in v0.64.0
func GetAllTableNames(ctx context.Context, conn Connection) ([]string, error)
func GetAtHeightUsingConnection ¶ added in v0.71.0
func GetLastBlockUsingConnection ¶ added in v0.60.0
func GetOldestHistoryBlockUsingConnection ¶ added in v0.60.0
func HasVegaSchema ¶ added in v0.64.0
func HasVegaSchema(ctx context.Context, conn Connection) (bool, error)
func MigrateDownToSchemaVersion ¶ added in v0.71.0
func MigrateUpToSchemaVersion ¶ added in v0.71.0
func PaginateQuery ¶
func PaginateQuery[T any, PT parserPtr[T]]( query string, args []interface{}, ordering TableOrdering, pagination entities.CursorPagination, ) (string, []interface{}, error)
PaginateQuery takes a query string & bind arg list and returns the same with additional SQL to
- exclude rows before the cursor (or after it if the cursor is a backwards looking one)
- limit the number of rows to the pagination limit +1 (no cursor) or +2 (cursor) [for purposes of later figuring out whether there are next or previous pages]
- order the query according to the TableOrdering supplied the order is reversed if pagination request is backwards
For example with cursor to a row where foo=42, and a pagination saying get the next 3 then: PaginateQuery[MyCursor]("SELECT foo FROM my_table", args, ordering, pagination)
Would append `42` to the arg list and return SELECT foo FROM my_table WHERE foo>=$1 ORDER BY foo ASC LIMIT 5
See CursorPredicate() for more details about how the cursor filtering is done.
func PaginateQueryWithoutOrderBy ¶ added in v0.69.0
func PaginateQueryWithoutOrderBy[T any, PT parserPtr[T]]( query string, args []interface{}, ordering TableOrdering, pagination entities.CursorPagination, ) (string, []interface{}, error)
func RecreateVegaDatabase ¶ added in v0.57.0
func RevertToSchemaVersionZero ¶ added in v0.64.0
func SanitizeSql ¶ added in v0.71.0
nolint:nakedret
func StartEmbeddedPostgres ¶
func StartEmbeddedPostgres(log *logging.Logger, config Config, runtimeDir string, postgresLog EmbeddedPostgresLog) (*embeddedpostgres.EmbeddedPostgres, error)
func StructValueForColumn ¶
StructValueForColumn replicates some of the unexported functionality from Scanny. You pass a struct (or pointer to a struct), and a column name. It converts the struct field names into database column names in a similar way to scanny and if one matches colName, that field value is returned. For example
type Foo struct { Thingy int `db:"wotsit"` SomethingElse int } val, err := StructValueForColumn(foo, "wotsit") -> 1 val, err := StructValueForColumn(&foo, "something_else") -> 2
NB - not all functionality of scanny is supported (but could be added if needed)
- we don't support embedded structs
- assumes the 'dbTag' is the default 'db'
func WipeDatabaseAndMigrateSchemaToLatestVersion ¶ added in v0.65.0
func WipeDatabaseAndMigrateSchemaToVersion ¶ added in v0.65.0
Types ¶
type AccountSource ¶
type AccountSource interface {
Query(filter entities.AccountFilter) ([]entities.Account, error)
}
type Accounts ¶
type Accounts struct { *ConnectionSource // contains filtered or unexported fields }
func NewAccounts ¶
func NewAccounts(connectionSource *ConnectionSource) *Accounts
func (*Accounts) GetBalancesByTxHash ¶ added in v0.71.0
func (*Accounts) GetByTxHash ¶ added in v0.71.0
func (*Accounts) Obtain ¶
Obtain will either fetch or create an account in the database. If an account with matching party/asset/market/type does not exist in the database, create one. If an account already exists, fetch that one. In either case, update the entities.Account object passed with an ID from the database.
func (*Accounts) QueryBalances ¶
func (as *Accounts) QueryBalances(ctx context.Context, filter entities.AccountFilter, pagination entities.CursorPagination, ) ([]entities.AccountBalance, entities.PageInfo, error)
type Assets ¶
type Assets struct { *ConnectionSource // contains filtered or unexported fields }
func NewAssets ¶
func NewAssets(connectionSource *ConnectionSource) *Assets
func (*Assets) GetAllWithCursorPagination ¶
type Balances ¶
type Balances struct { *ConnectionSource // contains filtered or unexported fields }
func NewBalances ¶
func NewBalances(connectionSource *ConnectionSource) *Balances
func (*Balances) Add ¶
func (bs *Balances) Add(b entities.AccountBalance) error
Add inserts a row to the balance table. If there's already a balance for this (account, block time) update it to match with the one supplied.
type Blocks ¶
type Blocks struct { *ConnectionSource // contains filtered or unexported fields }
func NewBlocks ¶
func NewBlocks(connectionSource *ConnectionSource) *Blocks
func (*Blocks) GetAtHeight ¶
func (*Blocks) GetLastBlock ¶
GetLastBlock return the last block or ErrNoLastBlock if no block is found.
type Candles ¶
type Candles struct { *ConnectionSource // contains filtered or unexported fields }
func NewCandles ¶
func NewCandles(ctx context.Context, connectionSource *ConnectionSource, config candlesv2.CandleStoreConfig) *Candles
func (*Candles) CandleExists ¶
func (*Candles) GetCandleDataForTimeSpan ¶
func (cs *Candles) GetCandleDataForTimeSpan(ctx context.Context, candleID string, from *time.Time, to *time.Time, p entities.CursorPagination) ([]entities.Candle, entities.PageInfo, error, )
GetCandleDataForTimeSpan gets the candles for a given interval, from and to are optional.
func (*Candles) GetCandleIDForIntervalAndMarket ¶ added in v0.55.0
type Chain ¶
type Chain struct {
*ConnectionSource
}
func NewChain ¶
func NewChain(connectionSource *ConnectionSource) *Chain
type Checkpoints ¶
type Checkpoints struct {
*ConnectionSource
}
func NewCheckpoints ¶
func NewCheckpoints(connectionSource *ConnectionSource) *Checkpoints
func (*Checkpoints) Add ¶
func (c *Checkpoints) Add(ctx context.Context, r entities.Checkpoint) error
func (*Checkpoints) GetAll ¶
func (c *Checkpoints) GetAll(ctx context.Context, pagination entities.CursorPagination) ([]entities.Checkpoint, entities.PageInfo, error)
type ChunkInterval ¶ added in v0.70.0
type ChunkInterval struct { HypertableOrCaggName string `` /* 134-byte string literal not displayed */ ChunkInterval string `string:"chunk-interval" description:"the interval at which to create new chunks, e.g '1 day', '1 month', '1 year' etc."` }
func (ChunkInterval) EntityName ¶ added in v0.70.0
func (p ChunkInterval) EntityName() string
type ColumnOrdering ¶
type ColumnOrdering struct { // Name of the column in the database table to match to the struct field Name string // Sorting is the sorting order to use for the column Sorting Sorting }
func NewColumnOrdering ¶
func NewColumnOrdering(name string, sorting Sorting) ColumnOrdering
type Config ¶
type Config struct { ConnectionConfig ConnectionConfig `group:"ConnectionConfig" namespace:"ConnectionConfig"` WipeOnStartup encoding.Bool `long:"wipe-on-startup" description:"deprecated, use data-node unsafe_reset_all command instead"` Level encoding.LogLevel `long:"log-level"` UseEmbedded encoding.Bool `long:"use-embedded" description:"Use an embedded version of Postgresql for the SQL data store"` FanOutBufferSize int `long:"fan-out-buffer-size" description:"buffer size used by the fan out event source"` RetentionPolicies []RetentionPolicy `group:"RetentionPolicies" namespace:"RetentionPolicies"` ConnectionRetryConfig ConnectionRetryConfig `group:"ConnectionRetryConfig" namespace:"ConnectionRetryConfig"` LogRotationConfig LogRotationConfig `group:"LogRotationConfig" namespace:"LogRotationConfig"` DisableMinRetentionPolicyCheckForUseInSysTestsOnly encoding.Bool `` /* 154-byte string literal not displayed */ RetentionPeriod RetentionPeriod `long:"retention-period" description:"Set the retention level for the database. standard, archive, or lite"` VerboseMigration encoding.Bool `long:"verbose-migration" description:"Enable verbose logging of SQL migrations"` ChunkIntervals []ChunkInterval `group:"ChunkIntervals" namespace:"ChunkIntervals"` }
func NewDefaultConfig ¶
func NewDefaultConfig() Config
type Connection ¶
type Connection interface { Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error) Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error) }
type ConnectionConfig ¶
type ConnectionConfig struct { Host string `long:"host"` Port int `long:"port"` Username string `long:"username"` Password string `long:"password"` Database string `long:"database"` SocketDir string `long:"socket-dir" description:"location of postgres UNIX socket directory (used if host is empty string)"` MaxConnLifetime encoding.Duration `long:"max-conn-lifetime"` MaxConnLifetimeJitter encoding.Duration `long:"max-conn-lifetime-jitter"` MaxConnPoolSize int `long:"max-conn-pool-size"` MinConnPoolSize int32 `long:"min-conn-pool-size"` }
func (ConnectionConfig) GetConnectionString ¶
func (conf ConnectionConfig) GetConnectionString() string
func (ConnectionConfig) GetConnectionStringForPostgresDatabase ¶ added in v0.57.0
func (conf ConnectionConfig) GetConnectionStringForPostgresDatabase() string
func (ConnectionConfig) GetPoolConfig ¶
func (conf ConnectionConfig) GetPoolConfig() (*pgxpool.Config, error)
type ConnectionRetryConfig ¶ added in v0.59.0
type ConnectionRetryConfig struct { MaxRetries uint64 `long:"max-retries" description:"the maximum number of times to retry connecting to the database"` InitialInterval time.Duration `long:"initial-interval" description:"the initial interval to wait before retrying"` MaxInterval time.Duration `long:"max-interval" description:"the maximum interval to wait before retrying"` MaxElapsedTime time.Duration `long:"max-elapsed-time" description:"the maximum elapsed time to wait before giving up"` }
type ConnectionSource ¶
type ConnectionSource struct { Connection copyingConnection // contains filtered or unexported fields }
func NewTransactionalConnectionSource ¶
func NewTransactionalConnectionSource(log *logging.Logger, connConfig ConnectionConfig) (*ConnectionSource, error)
func (*ConnectionSource) AfterCommit ¶ added in v0.55.0
func (s *ConnectionSource) AfterCommit(ctx context.Context, f func())
func (*ConnectionSource) Close ¶ added in v0.60.0
func (s *ConnectionSource) Close()
func (*ConnectionSource) Rollback ¶ added in v0.64.0
func (s *ConnectionSource) Rollback(ctx context.Context) error
func (*ConnectionSource) WithConnection ¶
func (*ConnectionSource) WithTransaction ¶
type CoreSnapshotData ¶ added in v0.65.0
type CoreSnapshotData struct {
*ConnectionSource
}
func NewCoreSnapshotData ¶ added in v0.65.0
func NewCoreSnapshotData(connectionSource *ConnectionSource) *CoreSnapshotData
func (*CoreSnapshotData) Add ¶ added in v0.65.0
func (s *CoreSnapshotData) Add(ctx context.Context, csd entities.CoreSnapshotData) error
func (*CoreSnapshotData) List ¶ added in v0.65.0
func (s *CoreSnapshotData) List(ctx context.Context, pagination entities.CursorPagination) ([]entities.CoreSnapshotData, entities.PageInfo, error)
type CursorQueryParameter ¶
func NewCursorQueryParameter ¶
func NewCursorQueryParameter(columnName string, sort Sorting, cmp Compare, value any) CursorQueryParameter
func (CursorQueryParameter) OrderBy ¶
func (c CursorQueryParameter) OrderBy() string
func (CursorQueryParameter) Where ¶
func (c CursorQueryParameter) Where(args ...interface{}) (string, []interface{})
type CursorQueryParameters ¶
type CursorQueryParameters []CursorQueryParameter
func (CursorQueryParameters) OrderBy ¶
func (c CursorQueryParameters) OrderBy() string
func (CursorQueryParameters) Where ¶
func (c CursorQueryParameters) Where(args ...interface{}) (string, []interface{})
type DatanodeBlockSpan ¶ added in v0.64.0
func GetDatanodeBlockSpan ¶ added in v0.64.0
type Delegations ¶
type Delegations struct {
*ConnectionSource
}
func NewDelegations ¶
func NewDelegations(connectionSource *ConnectionSource) *Delegations
func (*Delegations) Add ¶
func (ds *Delegations) Add(ctx context.Context, d entities.Delegation) error
func (*Delegations) Get ¶
func (ds *Delegations) Get(ctx context.Context, partyIDHex *string, nodeIDHex *string, epochID *int64, pagination entities.Pagination, ) ([]entities.Delegation, entities.PageInfo, error)
func (*Delegations) GetAll ¶
func (ds *Delegations) GetAll(ctx context.Context) ([]entities.Delegation, error)
func (*Delegations) GetByTxHash ¶ added in v0.71.0
func (ds *Delegations) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Delegation, error)
type Deposits ¶
type Deposits struct {
*ConnectionSource
}
func NewDeposits ¶
func NewDeposits(connectionSource *ConnectionSource) *Deposits
func (*Deposits) GetByParty ¶
func (*Deposits) GetByTxHash ¶ added in v0.71.0
type ERC20MultiSigSignerEvent ¶
type ERC20MultiSigSignerEvent struct {
*ConnectionSource
}
func NewERC20MultiSigSignerEvent ¶
func NewERC20MultiSigSignerEvent(connectionSource *ConnectionSource) *ERC20MultiSigSignerEvent
func (*ERC20MultiSigSignerEvent) Add ¶
func (m *ERC20MultiSigSignerEvent) Add(ctx context.Context, e *entities.ERC20MultiSigSignerEvent) error
func (*ERC20MultiSigSignerEvent) GetAddedByTxHash ¶ added in v0.71.0
func (m *ERC20MultiSigSignerEvent) GetAddedByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.ERC20MultiSigSignerAddedEvent, error)
func (*ERC20MultiSigSignerEvent) GetAddedEvents ¶
func (m *ERC20MultiSigSignerEvent) GetAddedEvents(ctx context.Context, validatorID string, submitter string, epochID *int64, pagination entities.CursorPagination) ( []entities.ERC20MultiSigSignerEvent, entities.PageInfo, error, )
func (*ERC20MultiSigSignerEvent) GetRemovedByTxHash ¶ added in v0.71.0
func (m *ERC20MultiSigSignerEvent) GetRemovedByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.ERC20MultiSigSignerRemovedEvent, error)
func (*ERC20MultiSigSignerEvent) GetRemovedEvents ¶
func (m *ERC20MultiSigSignerEvent) GetRemovedEvents(ctx context.Context, validatorID string, submitter string, epochID *int64, pagination entities.CursorPagination) ([]entities.ERC20MultiSigSignerEvent, entities.PageInfo, error)
type EmbeddedPostgresLog ¶ added in v0.60.0
type Epochs ¶
type Epochs struct {
*ConnectionSource
}
func NewEpochs ¶
func NewEpochs(connectionSource *ConnectionSource) *Epochs
type ErrInvalidCandleID ¶ added in v0.71.0
type ErrInvalidCandleID struct {
// contains filtered or unexported fields
}
func (ErrInvalidCandleID) Error ¶ added in v0.71.0
func (e ErrInvalidCandleID) Error() string
type EthereumKeyRotations ¶
type EthereumKeyRotations struct {
*ConnectionSource
}
func NewEthereumKeyRotations ¶
func NewEthereumKeyRotations(connectionSource *ConnectionSource) *EthereumKeyRotations
func (*EthereumKeyRotations) Add ¶
func (store *EthereumKeyRotations) Add(ctx context.Context, kr entities.EthereumKeyRotation) error
func (*EthereumKeyRotations) GetByTxHash ¶ added in v0.71.0
func (store *EthereumKeyRotations) GetByTxHash( ctx context.Context, txHash entities.TxHash, ) ([]entities.EthereumKeyRotation, error)
func (*EthereumKeyRotations) List ¶
func (store *EthereumKeyRotations) List(ctx context.Context, nodeID entities.NodeID, pagination entities.CursorPagination, ) ([]entities.EthereumKeyRotation, entities.PageInfo, error)
type HypertableOverride ¶ added in v0.70.0
type HypertableOverride interface { RetentionPolicy | ChunkInterval EntityName() string }
type KeyRotations ¶
type KeyRotations struct {
*ConnectionSource
}
func NewKeyRotations ¶
func NewKeyRotations(connectionSource *ConnectionSource) *KeyRotations
func (*KeyRotations) GetAllPubKeyRotations ¶
func (store *KeyRotations) GetAllPubKeyRotations(ctx context.Context, pagination entities.CursorPagination) ([]entities.KeyRotation, entities.PageInfo, error)
func (*KeyRotations) GetByTxHash ¶ added in v0.71.0
func (store *KeyRotations) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.KeyRotation, error)
func (*KeyRotations) GetPubKeyRotationsPerNode ¶
func (store *KeyRotations) GetPubKeyRotationsPerNode(ctx context.Context, nodeID string, pagination entities.CursorPagination) ([]entities.KeyRotation, entities.PageInfo, error)
func (*KeyRotations) Upsert ¶
func (store *KeyRotations) Upsert(ctx context.Context, kr *entities.KeyRotation) error
type Ledger ¶
type Ledger struct { *ConnectionSource // contains filtered or unexported fields }
func NewLedger ¶
func NewLedger(connectionSource *ConnectionSource) *Ledger
func (*Ledger) GetByLedgerEntryTime ¶ added in v0.57.0
func (*Ledger) GetByTxHash ¶ added in v0.71.0
func (*Ledger) Query ¶ added in v0.58.0
func (ls *Ledger) Query( ctx context.Context, filter *entities.LedgerEntryFilter, dateRange entities.DateRange, pagination entities.CursorPagination, ) (*[]entities.AggregatedLedgerEntry, entities.PageInfo, error)
This query requests and sums number of the ledger entries of a given subset of accounts, specified via the 'filter' argument. It returns a timeseries (implemented as a list of AggregateLedgerEntry structs), with a row for every time the summed ledger entries of the set of specified accounts changes. Listed queries should be limited to a single party from each side only. If no or more than one parties are provided for sending and receiving accounts - the query returns error.
Entries can be queried by:
- listing ledger entries with filtering on the sending account (market_id, asset_id, account_type)
- listing ledger entries with filtering on the receiving account (market_id, asset_id, account_type)
- listing ledger entries with filtering on the sending AND receiving account
- listing ledger entries with filtering on the transfer type (on top of above filters or as a standalone option)
type LiquidityProvision ¶
type LiquidityProvision struct { *ConnectionSource // contains filtered or unexported fields }
func NewLiquidityProvision ¶
func NewLiquidityProvision(connectionSource *ConnectionSource, log *logging.Logger) *LiquidityProvision
func (*LiquidityProvision) GetByTxHash ¶ added in v0.71.0
func (lp *LiquidityProvision) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.LiquidityProvision, error)
func (*LiquidityProvision) ObserveLiquidityProvisions ¶ added in v0.55.0
func (lp *LiquidityProvision) ObserveLiquidityProvisions(ctx context.Context, retries int, market *string, party *string, ) (<-chan []entities.LiquidityProvision, uint64)
func (*LiquidityProvision) Upsert ¶
func (lp *LiquidityProvision) Upsert(ctx context.Context, liquidityProvision entities.LiquidityProvision) error
type ListBatcher ¶
type ListBatcher[T simpleEntity] struct {
// contains filtered or unexported fields
}
func NewListBatcher ¶
func NewListBatcher[T simpleEntity](tableName string, columnNames []string) ListBatcher[T]
func (*ListBatcher[T]) Add ¶
func (b *ListBatcher[T]) Add(entity T)
func (*ListBatcher[T]) Flush ¶
func (b *ListBatcher[T]) Flush(ctx context.Context, connection Connection) ([]T, error)
type LogRotationConfig ¶ added in v0.62.0
type MapBatcher ¶
type MapBatcher[K entityKey, V entity[K]] struct {
// contains filtered or unexported fields
}
func NewMapBatcher ¶
func NewMapBatcher[K entityKey, V entity[K]](tableName string, columnNames []string) MapBatcher[K, V]
func (*MapBatcher[K, V]) Add ¶
func (b *MapBatcher[K, V]) Add(e V)
func (*MapBatcher[K, V]) Flush ¶
func (b *MapBatcher[K, V]) Flush(ctx context.Context, connection Connection) ([]V, error)
type MarginLevels ¶
type MarginLevels struct { *ConnectionSource // contains filtered or unexported fields }
func NewMarginLevels ¶
func NewMarginLevels(connectionSource *ConnectionSource) *MarginLevels
func (*MarginLevels) Add ¶
func (ml *MarginLevels) Add(marginLevel entities.MarginLevels) error
func (*MarginLevels) Flush ¶
func (ml *MarginLevels) Flush(ctx context.Context) ([]entities.MarginLevels, error)
func (*MarginLevels) GetByTxHash ¶ added in v0.71.0
func (ml *MarginLevels) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.MarginLevels, error)
func (*MarginLevels) GetMarginLevelsByIDWithCursorPagination ¶
func (ml *MarginLevels) GetMarginLevelsByIDWithCursorPagination(ctx context.Context, partyID, marketID string, pagination entities.CursorPagination) ([]entities.MarginLevels, entities.PageInfo, error)
type MarketData ¶
type MarketData struct { *ConnectionSource // contains filtered or unexported fields }
func NewMarketData ¶
func NewMarketData(connectionSource *ConnectionSource) *MarketData
func (*MarketData) Add ¶
func (md *MarketData) Add(data *entities.MarketData) error
func (*MarketData) Flush ¶
func (md *MarketData) Flush(ctx context.Context) ([]*entities.MarketData, error)
func (*MarketData) GetBetweenDatesByID ¶
func (md *MarketData) GetBetweenDatesByID(ctx context.Context, marketID string, start, end time.Time, pagination entities.Pagination) ([]entities.MarketData, entities.PageInfo, error)
func (*MarketData) GetFromDateByID ¶
func (md *MarketData) GetFromDateByID(ctx context.Context, marketID string, start time.Time, pagination entities.Pagination) ([]entities.MarketData, entities.PageInfo, error)
func (*MarketData) GetMarketDataByID ¶
func (md *MarketData) GetMarketDataByID(ctx context.Context, marketID string) (entities.MarketData, error)
func (*MarketData) GetMarketsData ¶
func (md *MarketData) GetMarketsData(ctx context.Context) ([]entities.MarketData, error)
func (*MarketData) GetToDateByID ¶
func (md *MarketData) GetToDateByID(ctx context.Context, marketID string, end time.Time, pagination entities.Pagination) ([]entities.MarketData, entities.PageInfo, error)
type Markets ¶
type Markets struct { *ConnectionSource // contains filtered or unexported fields }
func NewMarkets ¶
func NewMarkets(connectionSource *ConnectionSource) *Markets
func (*Markets) GetAllPaged ¶
func (*Markets) GetByTxHash ¶ added in v0.71.0
type NetworkLimits ¶
type NetworkLimits struct {
*ConnectionSource
}
func NewNetworkLimits ¶
func NewNetworkLimits(connectionSource *ConnectionSource) *NetworkLimits
func (*NetworkLimits) Add ¶
func (nl *NetworkLimits) Add(ctx context.Context, limits entities.NetworkLimits) error
Add inserts a row into the network limits table. If a row with the same vega time exists, that row is updated instead. (i.e. there are multiple updates of the limits in one block, does occur).
func (*NetworkLimits) GetLatest ¶
func (nl *NetworkLimits) GetLatest(ctx context.Context) (entities.NetworkLimits, error)
GetLatest returns the most recent network limits.
type NetworkParameters ¶
type NetworkParameters struct { *ConnectionSource // contains filtered or unexported fields }
func NewNetworkParameters ¶
func NewNetworkParameters(connectionSource *ConnectionSource) *NetworkParameters
func (*NetworkParameters) Add ¶
func (np *NetworkParameters) Add(ctx context.Context, r entities.NetworkParameter) error
func (*NetworkParameters) GetAll ¶
func (np *NetworkParameters) GetAll(ctx context.Context, pagination entities.CursorPagination) ([]entities.NetworkParameter, entities.PageInfo, error)
func (*NetworkParameters) GetByKey ¶ added in v0.57.0
func (np *NetworkParameters) GetByKey(ctx context.Context, key string) (entities.NetworkParameter, error)
func (*NetworkParameters) GetByTxHash ¶ added in v0.71.0
func (np *NetworkParameters) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.NetworkParameter, error)
type Node ¶
type Node struct {
*ConnectionSource
}
func NewNode ¶
func NewNode(connectionSource *ConnectionSource) *Node
func (*Node) AddNodeAnnouncedEvent ¶ added in v0.55.0
func (store *Node) AddNodeAnnouncedEvent(ctx context.Context, nodeID string, vegatime time.Time, aux *entities.ValidatorUpdateAux) error
AddNodeAnnouncedEvent store data about which epoch a particular node was added or removed from the roster of validators.
func (*Node) GetByTxHash ¶ added in v0.71.0
func (*Node) GetNodeByID ¶
func (*Node) GetNodeData ¶
func (*Node) GetNodeTxHash ¶ added in v0.71.0
func (*Node) UpdateEthereumAddress ¶
func (*Node) UpdatePublicKey ¶
func (*Node) UpsertNode ¶
func (*Node) UpsertRanking ¶
func (store *Node) UpsertRanking(ctx context.Context, rs *entities.RankingScore, aux *entities.RankingScoreAux) error
func (*Node) UpsertScore ¶
func (store *Node) UpsertScore(ctx context.Context, rs *entities.RewardScore, aux *entities.RewardScoreAux) error
type Notary ¶
type Notary struct {
*ConnectionSource
}
func NewNotary ¶
func NewNotary(connectionSource *ConnectionSource) *Notary
func (*Notary) GetByResourceID ¶
func (*Notary) GetByTxHash ¶ added in v0.71.0
type OracleData ¶
type OracleData struct {
*ConnectionSource
}
func NewOracleData ¶
func NewOracleData(connectionSource *ConnectionSource) *OracleData
func (*OracleData) Add ¶
func (od *OracleData) Add(ctx context.Context, oracleData *entities.OracleData) error
func (*OracleData) GetByTxHash ¶ added in v0.71.0
func (od *OracleData) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.OracleData, error)
func (*OracleData) GetOracleDataBySpecID ¶
func (od *OracleData) GetOracleDataBySpecID(ctx context.Context, id string, pagination entities.Pagination) ([]entities.OracleData, entities.PageInfo, error)
func (*OracleData) ListOracleData ¶
func (od *OracleData) ListOracleData(ctx context.Context, pagination entities.Pagination) ([]entities.OracleData, entities.PageInfo, error)
type OracleSpec ¶
type OracleSpec struct {
*ConnectionSource
}
func NewOracleSpec ¶
func NewOracleSpec(connectionSource *ConnectionSource) *OracleSpec
func (*OracleSpec) GetByTxHash ¶ added in v0.71.0
func (os *OracleSpec) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.OracleSpec, error)
func (*OracleSpec) GetSpecByID ¶
func (os *OracleSpec) GetSpecByID(ctx context.Context, specID string) (*entities.OracleSpec, error)
func (*OracleSpec) GetSpecsWithCursorPagination ¶
func (os *OracleSpec) GetSpecsWithCursorPagination(ctx context.Context, specID string, pagination entities.CursorPagination) ( []entities.OracleSpec, entities.PageInfo, error, )
func (*OracleSpec) Upsert ¶
func (os *OracleSpec) Upsert(ctx context.Context, spec *entities.OracleSpec) error
type Orders ¶
type Orders struct { *ConnectionSource // contains filtered or unexported fields }
func NewOrders ¶
func NewOrders(connectionSource *ConnectionSource) *Orders
func (*Orders) Add ¶
Add inserts an order update row into the database if an row for this (block time, order id, version) does not already exist; otherwise update the existing row with information supplied. Currently we only store the last update to an order per block, so the order history is not complete if multiple updates happen in one block.
func (*Orders) GetAll ¶
GetAll returns all updates to all orders (including changes to orders that don't increment the version number).
func (*Orders) GetByMarketAndID ¶ added in v0.68.0
func (os *Orders) GetByMarketAndID(ctx context.Context, marketIDstr string, orderIDs []string) ([]entities.Order, error)
GetByMarketAndID returns all orders with given IDs for a market.
func (*Orders) GetByReferencePaged ¶
func (os *Orders) GetByReferencePaged(ctx context.Context, reference string, p entities.CursorPagination) ([]entities.Order, entities.PageInfo, error)
GetByReference returns the last update of orders with the specified user-suppled reference.
func (*Orders) GetByTxHash ¶ added in v0.71.0
func (*Orders) GetLiveOrders ¶
GetLiveOrders fetches all currently live orders so the market depth data can be rebuilt from the orders data in the database.
func (*Orders) GetOrder ¶
func (os *Orders) GetOrder(ctx context.Context, orderIDStr string, version *int32) (entities.Order, error)
GetOrder returns the last update of the order with the given ID.
func (*Orders) ListOrderVersions ¶
func (*Orders) ListOrders ¶
type Parties ¶
type Parties struct {
*ConnectionSource
}
func NewParties ¶
func NewParties(connectionSource *ConnectionSource) *Parties
func (*Parties) GetAllPaged ¶
func (*Parties) GetByTxHash ¶ added in v0.71.0
func (*Parties) Initialise ¶
Initialise adds the built-in 'network' party which is never explicitly sent on the event bus, but nonetheless is necessary.
type Positions ¶
type Positions struct { *ConnectionSource // contains filtered or unexported fields }
func NewPositions ¶
func NewPositions(connectionSource *ConnectionSource) *Positions
func (*Positions) GetByMarket ¶
func (*Positions) GetByMarketAndParties ¶ added in v0.68.0
func (*Positions) GetByMarketAndParty ¶
func (*Positions) GetByParty ¶
func (*Positions) GetByPartyConnection ¶
type Proposals ¶
type Proposals struct {
*ConnectionSource
}
func NewProposals ¶
func NewProposals(connectionSource *ConnectionSource) *Proposals
func (*Proposals) Get ¶
func (ps *Proposals) Get(ctx context.Context, inState *entities.ProposalState, partyIDStr *string, proposalType *entities.ProposalType, pagination entities.CursorPagination, ) ([]entities.Proposal, entities.PageInfo, error)
func (*Proposals) GetByReference ¶
type ProtocolUpgradeProposals ¶ added in v0.61.0
type ProtocolUpgradeProposals struct {
*ConnectionSource
}
func NewProtocolUpgradeProposals ¶ added in v0.61.0
func NewProtocolUpgradeProposals(connectionSource *ConnectionSource) *ProtocolUpgradeProposals
func (*ProtocolUpgradeProposals) Add ¶ added in v0.61.0
func (ps *ProtocolUpgradeProposals) Add(ctx context.Context, p entities.ProtocolUpgradeProposal) error
func (*ProtocolUpgradeProposals) GetByTxHash ¶ added in v0.71.0
func (ps *ProtocolUpgradeProposals) GetByTxHash( ctx context.Context, txHash entities.TxHash, ) ([]entities.ProtocolUpgradeProposal, error)
func (*ProtocolUpgradeProposals) List ¶ added in v0.61.0
func (ps *ProtocolUpgradeProposals) List(ctx context.Context, status *entities.ProtocolUpgradeProposalStatus, approvedBy *string, pagination entities.CursorPagination, ) ([]entities.ProtocolUpgradeProposal, entities.PageInfo, error)
type RetentionPeriod ¶ added in v0.68.0
type RetentionPeriod string
const ( RetentionPeriodStandard RetentionPeriod = "standard" RetentionPeriodArchive RetentionPeriod = "forever" RetentionPeriodLite RetentionPeriod = "1 day" )
type RetentionPolicy ¶
type RetentionPolicy struct { HypertableOrCaggName string `` /* 134-byte string literal not displayed */ DataRetentionPeriod string `` /* 144-byte string literal not displayed */ }
func (RetentionPolicy) EntityName ¶ added in v0.70.0
func (p RetentionPolicy) EntityName() string
type Rewards ¶
type Rewards struct {
*ConnectionSource
}
func NewRewards ¶
func NewRewards(connectionSource *ConnectionSource) *Rewards
func (*Rewards) GetByCursor ¶
func (*Rewards) GetByTxHash ¶ added in v0.71.0
func (*Rewards) GetEpochSummaries ¶ added in v0.65.0
func (rs *Rewards) GetEpochSummaries(ctx context.Context, filter entities.RewardSummaryFilter, pagination entities.CursorPagination, ) ([]entities.EpochRewardSummary, entities.PageInfo, error)
GetEpochSummaries returns paged epoch reward summary aggregated by asset, market, and reward type for a given range of epochs.
func (*Rewards) GetSummaries ¶
type RiskFactors ¶
type RiskFactors struct {
*ConnectionSource
}
func NewRiskFactors ¶
func NewRiskFactors(connectionSource *ConnectionSource) *RiskFactors
func (*RiskFactors) GetMarketRiskFactors ¶
func (rf *RiskFactors) GetMarketRiskFactors(ctx context.Context, marketID string) (entities.RiskFactor, error)
func (*RiskFactors) Upsert ¶
func (rf *RiskFactors) Upsert(ctx context.Context, factor *entities.RiskFactor) error
type StakeLinking ¶
type StakeLinking struct {
*ConnectionSource
}
func NewStakeLinking ¶
func NewStakeLinking(connectionSource *ConnectionSource) *StakeLinking
func (*StakeLinking) GetStake ¶
func (s *StakeLinking) GetStake(ctx context.Context, partyID entities.PartyID, p entities.Pagination, ) (*num.Uint, []entities.StakeLinking, entities.PageInfo, error)
func (*StakeLinking) Upsert ¶
func (s *StakeLinking) Upsert(ctx context.Context, stake *entities.StakeLinking) error
type TableOrdering ¶
type TableOrdering []ColumnOrdering
func (*TableOrdering) OrderByClause ¶
func (t *TableOrdering) OrderByClause() string
func (*TableOrdering) Reversed ¶
func (t *TableOrdering) Reversed() TableOrdering
type Trades ¶
type Trades struct { *ConnectionSource // contains filtered or unexported fields }
func NewTrades ¶
func NewTrades(connectionSource *ConnectionSource) *Trades
func (*Trades) GetByTxHash ¶ added in v0.71.0
func (*Trades) GetLastTradeByMarket ¶ added in v0.71.0
type Transfers ¶
type Transfers struct {
*ConnectionSource
}
func NewTransfers ¶
func NewTransfers(connectionSource *ConnectionSource) *Transfers
func (*Transfers) GetByTxHash ¶ added in v0.71.0
func (*Transfers) GetTransfersFromAccount ¶
func (*Transfers) GetTransfersFromParty ¶
func (*Transfers) GetTransfersToAccount ¶
func (*Transfers) GetTransfersToOrFromParty ¶
func (*Transfers) GetTransfersToParty ¶
type Votes ¶
type Votes struct {
*ConnectionSource
}
func NewVotes ¶
func NewVotes(connectionSource *ConnectionSource) *Votes
func (*Votes) GetByParty ¶
func (*Votes) GetByPartyConnection ¶
func (*Votes) GetByTxHash ¶ added in v0.71.0
func (*Votes) GetConnection ¶ added in v0.63.0
func (*Votes) GetNoVotesForProposal ¶
type Withdrawals ¶
type Withdrawals struct {
*ConnectionSource
}
func NewWithdrawals ¶
func NewWithdrawals(connectionSource *ConnectionSource) *Withdrawals
func (*Withdrawals) GetByID ¶
func (w *Withdrawals) GetByID(ctx context.Context, withdrawalID string) (entities.Withdrawal, error)
func (*Withdrawals) GetByParty ¶
func (w *Withdrawals) GetByParty(ctx context.Context, partyID string, openOnly bool, pagination entities.Pagination, dateRange entities.DateRange) ( []entities.Withdrawal, entities.PageInfo, error, )
func (*Withdrawals) GetByTxHash ¶ added in v0.71.0
func (w *Withdrawals) GetByTxHash(ctx context.Context, txHash entities.TxHash) ([]entities.Withdrawal, error)
func (*Withdrawals) Upsert ¶
func (w *Withdrawals) Upsert(ctx context.Context, withdrawal *entities.Withdrawal) error
Source Files
¶
- accounts.go
- accounts_filter.go
- assets.go
- balances.go
- batcher_list.go
- batcher_map.go
- blocks.go
- candles.go
- chain.go
- checkpoints.go
- config.go
- connection_source.go
- cursor.go
- delegations.go
- deposits.go
- epochs.go
- erc20_multisig_event.go
- ethereum_key_rotations.go
- key_rotations.go
- ledger.go
- ledgerentry_filter.go
- liquidity_provision.go
- margin_levels.go
- market_data.go
- markets.go
- network_limits.go
- network_parameters.go
- node.go
- notary.go
- oracle_data.go
- oracle_spec.go
- orders.go
- parties.go
- positions.go
- proposals.go
- protocol_upgrade_proposals.go
- rewards.go
- risk_factor.go
- sanitize.go
- snapshot_data.go
- sqlstore.go
- stake_linking.go
- trades.go
- transfers.go
- utils.go
- votes.go
- withdrawals.go