Documentation ¶
Overview ¶
Package history contains database record definitions useable for reading rows from a the history portion of millennium's database
Index ¶
- Variables
- func EncodeOfferId(id uint64, typ OfferIDType) int64
- type Account
- type AccountDataBatchInsertBuilder
- type AccountDataValue
- type AccountEntry
- type AccountSigner
- type AccountSignersBatchInsertBuilder
- type AccountsBatchInsertBuilder
- type Asset
- type ClaimableBalance
- type ClaimableBalancesBatchInsertBuilder
- type ClaimableBalancesQuery
- type Claimant
- type Claimants
- type Data
- type Effect
- type EffectBatchInsertBuilder
- type EffectType
- type EffectsQ
- func (q *EffectsQ) ForAccount(aid string) *EffectsQ
- func (q *EffectsQ) ForLedger(seq int32) *EffectsQ
- func (q *EffectsQ) ForOperation(id int64) *EffectsQ
- func (q *EffectsQ) ForTransaction(hash string) *EffectsQ
- func (q *EffectsQ) Page(page db2.PageQuery) *EffectsQ
- func (q *EffectsQ) Select(dest interface{}) error
- type ExpAssetStat
- type FeeBumpFixture
- type FeeStats
- type IngestionQ
- type InsertTrade
- type LatestLedger
- type Ledger
- type LedgerCache
- type LedgerCapacityUsageStats
- type LedgersQ
- type ManageOffer
- type MockAccountDataBatchInsertBuilder
- type MockAccountSignersBatchInsertBuilder
- type MockClaimableBalancesBatchInsertBuilder
- type MockEffectBatchInsertBuilder
- type MockOffersBatchInsertBuilder
- type MockOperationParticipantBatchInsertBuilder
- type MockOperationsBatchInsertBuilder
- type MockQAccounts
- func (m *MockQAccounts) GetAccountsByIDs(ids []string) ([]AccountEntry, error)
- func (m *MockQAccounts) NewAccountsBatchInsertBuilder(maxBatchSize int) AccountsBatchInsertBuilder
- func (m *MockQAccounts) RemoveAccount(accountID string) (int64, error)
- func (m *MockQAccounts) UpsertAccounts(accounts []xdr.LedgerEntry) error
- type MockQAssetStats
- func (m *MockQAssetStats) CountTrustLines() (int, error)
- func (m *MockQAssetStats) GetAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (ExpAssetStat, error)
- func (m *MockQAssetStats) GetAssetStats(assetCode, assetIssuer string, page db2.PageQuery) ([]ExpAssetStat, error)
- func (m *MockQAssetStats) InsertAssetStat(assetStat ExpAssetStat) (int64, error)
- func (m *MockQAssetStats) InsertAssetStats(assetStats []ExpAssetStat, batchSize int) error
- func (m *MockQAssetStats) RemoveAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (int64, error)
- func (m *MockQAssetStats) UpdateAssetStat(assetStat ExpAssetStat) (int64, error)
- type MockQClaimableBalances
- func (m *MockQClaimableBalances) CountClaimableBalances() (int, error)
- func (m *MockQClaimableBalances) GetClaimableBalancesByID(ids []xdr.ClaimableBalanceId) ([]ClaimableBalance, error)
- func (m *MockQClaimableBalances) NewClaimableBalancesBatchInsertBuilder(maxBatchSize int) ClaimableBalancesBatchInsertBuilder
- func (m *MockQClaimableBalances) RemoveClaimableBalance(cBalance xdr.ClaimableBalanceEntry) (int64, error)
- func (m *MockQClaimableBalances) UpdateClaimableBalance(entry xdr.LedgerEntry) (int64, error)
- type MockQData
- func (m *MockQData) CountAccountsData() (int, error)
- func (m *MockQData) GetAccountDataByKeys(keys []xdr.LedgerKeyData) ([]Data, error)
- func (m *MockQData) InsertAccountData(entry xdr.LedgerEntry) (int64, error)
- func (m *MockQData) NewAccountDataBatchInsertBuilder(maxBatchSize int) AccountDataBatchInsertBuilder
- func (m *MockQData) RemoveAccountData(key xdr.LedgerKeyData) (int64, error)
- func (m *MockQData) UpdateAccountData(entry xdr.LedgerEntry) (int64, error)
- type MockQEffects
- type MockQLedgers
- type MockQOffers
- func (m *MockQOffers) CompactOffers(cutOffSequence uint32) (int64, error)
- func (m *MockQOffers) CountOffers() (int, error)
- func (m *MockQOffers) GetAllOffers() ([]Offer, error)
- func (m *MockQOffers) GetOffersByIDs(ids []int64) ([]Offer, error)
- func (m *MockQOffers) GetUpdatedOffers(newerThanSequence uint32) ([]Offer, error)
- func (m *MockQOffers) NewOffersBatchInsertBuilder(maxBatchSize int) OffersBatchInsertBuilder
- func (m *MockQOffers) RemoveOffer(offerID int64, lastModifiedLedger uint32) (int64, error)
- func (m *MockQOffers) UpdateOffer(row Offer) (int64, error)
- type MockQOperations
- type MockQParticipants
- func (m *MockQParticipants) CreateAccounts(addresses []string, maxBatchSize int) (map[string]int64, error)
- func (m *MockQParticipants) NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder
- func (m *MockQParticipants) NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder
- type MockQSigners
- func (m *MockQSigners) AccountsForSigner(signer string, page db2.PageQuery) ([]AccountSigner, error)
- func (m *MockQSigners) CountAccounts() (int, error)
- func (m *MockQSigners) CreateAccountSigner(account, signer string, weight int32, sponsor *string) (int64, error)
- func (m *MockQSigners) GetLastLedgerExpIngest() (uint32, error)
- func (m *MockQSigners) GetLastLedgerExpIngestNonBlocking() (uint32, error)
- func (m *MockQSigners) NewAccountSignersBatchInsertBuilder(maxBatchSize int) AccountSignersBatchInsertBuilder
- func (m *MockQSigners) RemoveAccountSigner(account, signer string) (int64, error)
- func (m *MockQSigners) SignersForAccounts(accounts []string) ([]AccountSigner, error)
- func (m *MockQSigners) UpdateLastLedgerExpIngest(ledgerSequence uint32) error
- type MockQTrades
- type MockQTransactions
- type MockQTrustLines
- func (m *MockQTrustLines) GetTrustLinesByKeys(keys []xdr.LedgerKeyTrustLine) ([]TrustLine, error)
- func (m *MockQTrustLines) InsertTrustLine(entry xdr.LedgerEntry) (int64, error)
- func (m *MockQTrustLines) NewTrustLinesBatchInsertBuilder(maxBatchSize int) TrustLinesBatchInsertBuilder
- func (m *MockQTrustLines) RemoveTrustLine(key xdr.LedgerKeyTrustLine) (int64, error)
- func (m *MockQTrustLines) UpdateTrustLine(entry xdr.LedgerEntry) (int64, error)
- func (m *MockQTrustLines) UpsertTrustLines(trustLines []xdr.LedgerEntry) error
- type MockTradeBatchInsertBuilder
- type MockTransactionParticipantsBatchInsertBuilder
- type MockTransactionsBatchInsertBuilder
- type Offer
- type OfferIDType
- type OffersBatchInsertBuilder
- type OffersQuery
- type Operation
- type OperationBatchInsertBuilder
- type OperationParticipantBatchInsertBuilder
- type OperationsQ
- func (q *OperationsQ) Fetch() ([]Operation, []Transaction, error)
- func (q *OperationsQ) ForAccount(aid string) *OperationsQ
- func (q *OperationsQ) ForLedger(seq int32) *OperationsQ
- func (q *OperationsQ) ForTransaction(hash string) *OperationsQ
- func (q *OperationsQ) IncludeFailed() *OperationsQ
- func (q *OperationsQ) IncludeTransactions() *OperationsQ
- func (q *OperationsQ) OnlyPayments() *OperationsQ
- func (q *OperationsQ) Page(page db2.PageQuery) *OperationsQ
- type OrderBookSummary
- type PriceLevel
- type Q
- func (q *Q) AccountByAddress(dest interface{}, addy string) error
- func (q *Q) AccountEntriesForSigner(signer string, page db2.PageQuery) ([]AccountEntry, error)
- func (q *Q) AccountsByAddresses(dest interface{}, addresses []string) error
- func (q *Q) AccountsForAsset(asset xdr.Asset, page db2.PageQuery) ([]AccountEntry, error)
- func (q *Q) AccountsForSigner(signer string, page db2.PageQuery) ([]AccountSigner, error)
- func (q *Q) AccountsForSponsor(sponsor string, page db2.PageQuery) ([]AccountEntry, error)
- func (q *Q) AssetsForAddress(addy string) ([]xdr.Asset, []xdr.Int64, error)
- func (q *Q) CloneIngestionQ() IngestionQ
- func (q *Q) CompactOffers(cutOffSequence uint32) (int64, error)
- func (q *Q) CountAccounts() (int, error)
- func (q *Q) CountAccountsData() (int, error)
- func (q *Q) CountClaimableBalances() (int, error)
- func (q *Q) CountOffers() (int, error)
- func (q *Q) CountTrustLines() (int, error)
- func (q *Q) CreateAccountSigner(account, signer string, weight int32, sponsor *string) (int64, error)
- func (q *Q) CreateAccounts(addresses []string, batchSize int) (map[string]int64, error)
- func (q *Q) CreateAssets(assets []xdr.Asset, batchSize int) (map[string]Asset, error)
- func (q *Q) DeleteRangeAll(start, end int64) error
- func (q *Q) Effects() *EffectsQ
- func (q *Q) ElderLedger(dest interface{}) error
- func (q *Q) FeeStats(currentSeq int32, dest *FeeStats) error
- func (q *Q) FindClaimableBalanceByID(balanceID xdr.ClaimableBalanceId) (ClaimableBalance, error)
- func (q *Q) GetAccountByID(id string) (AccountEntry, error)
- func (q *Q) GetAccountDataByAccountID(id string) ([]Data, error)
- func (q *Q) GetAccountDataByAccountsID(id []string) ([]Data, error)
- func (q *Q) GetAccountDataByKeys(keys []xdr.LedgerKeyData) ([]Data, error)
- func (q *Q) GetAccountDataByName(id, name string) (Data, error)
- func (q *Q) GetAccountSignersByAccountID(id string) ([]AccountSigner, error)
- func (q *Q) GetAccountsByIDs(ids []string) ([]AccountEntry, error)
- func (q *Q) GetAllOffers() ([]Offer, error)
- func (q *Q) GetAssetID(asset xdr.Asset) (id int64, err error)
- func (q *Q) GetAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (ExpAssetStat, error)
- func (q *Q) GetAssetStats(assetCode, assetIssuer string, page db2.PageQuery) ([]ExpAssetStat, error)
- func (q *Q) GetClaimableBalances(query ClaimableBalancesQuery) ([]ClaimableBalance, error)
- func (q *Q) GetClaimableBalancesByID(ids []xdr.ClaimableBalanceId) ([]ClaimableBalance, error)
- func (q *Q) GetExpIngestVersion() (int, error)
- func (q *Q) GetExpStateInvalid() (bool, error)
- func (q *Q) GetLastLedgerExpIngest() (uint32, error)
- func (q *Q) GetLastLedgerExpIngestNonBlocking() (uint32, error)
- func (q *Q) GetLatestLedger() (uint32, error)
- func (q *Q) GetOfferByID(id int64) (Offer, error)
- func (q *Q) GetOfferCompactionSequence() (uint32, error)
- func (q *Q) GetOffers(query OffersQuery) ([]Offer, error)
- func (q *Q) GetOffersByIDs(ids []int64) ([]Offer, error)
- func (q *Q) GetOrderBookSummary(sellingAsset, buyingAsset xdr.Asset, maxPriceLevels int) (OrderBookSummary, error)
- func (q *Q) GetSequenceNumbers(addresses []string) (map[string]uint64, error)
- func (q *Q) GetSortedTrustLinesByAccountID(id string) ([]TrustLine, error)
- func (q *Q) GetSortedTrustLinesByAccountIDs(id []string) ([]TrustLine, error)
- func (q Q) GetTradeAggregationsQ(baseAssetID int64, counterAssetID int64, resolution int64, offset int64, ...) (*TradeAggregationsQ, error)
- func (q *Q) GetTrustLinesByKeys(keys []xdr.LedgerKeyTrustLine) ([]TrustLine, error)
- func (q *Q) GetUpdatedOffers(newerThanSequence uint32) ([]Offer, error)
- func (q *Q) InsertAccountData(entry xdr.LedgerEntry) (int64, error)
- func (q *Q) InsertAssetStat(assetStat ExpAssetStat) (int64, error)
- func (q *Q) InsertAssetStats(assetStats []ExpAssetStat, batchSize int) error
- func (q *Q) InsertLedger(ledger xdr.LedgerHeaderHistoryEntry, successTxsCount int, failedTxsCount int, ...) (int64, error)
- func (q *Q) InsertTrustLine(entry xdr.LedgerEntry) (int64, error)
- func (q *Q) LatestLedger(dest interface{}) error
- func (q *Q) LatestLedgerBaseFeeAndSequence(dest interface{}) error
- func (q *Q) LedgerBySequence(dest interface{}, seq int32) error
- func (q *Q) LedgerCapacityUsageStats(currentSeq int32, dest *LedgerCapacityUsageStats) error
- func (q *Q) Ledgers() *LedgersQ
- func (q *Q) LedgersBySequence(dest interface{}, seqs ...int32) error
- func (q *Q) NewAccountDataBatchInsertBuilder(maxBatchSize int) AccountDataBatchInsertBuilder
- func (q *Q) NewAccountSignersBatchInsertBuilder(maxBatchSize int) AccountSignersBatchInsertBuilder
- func (q *Q) NewAccountsBatchInsertBuilder(maxBatchSize int) AccountsBatchInsertBuilder
- func (q *Q) NewClaimableBalancesBatchInsertBuilder(maxBatchSize int) ClaimableBalancesBatchInsertBuilder
- func (q *Q) NewEffectBatchInsertBuilder(maxBatchSize int) EffectBatchInsertBuilder
- func (q *Q) NewOffersBatchInsertBuilder(maxBatchSize int) OffersBatchInsertBuilder
- func (q *Q) NewOperationBatchInsertBuilder(maxBatchSize int) OperationBatchInsertBuilder
- func (q *Q) NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder
- func (q *Q) NewTradeBatchInsertBuilder(maxBatchSize int) TradeBatchInsertBuilder
- func (q *Q) NewTransactionBatchInsertBuilder(maxBatchSize int) TransactionBatchInsertBuilder
- func (q *Q) NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder
- func (q *Q) NewTrustLinesBatchInsertBuilder(maxBatchSize int) TrustLinesBatchInsertBuilder
- func (q *Q) OperationByID(includeTransactions bool, id int64) (Operation, *Transaction, error)
- func (q *Q) Operations() *OperationsQ
- func (q *Q) RemoveAccount(accountID string) (int64, error)
- func (q *Q) RemoveAccountData(key xdr.LedgerKeyData) (int64, error)
- func (q *Q) RemoveAccountSigner(account, signer string) (int64, error)
- func (q *Q) RemoveAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (int64, error)
- func (q *Q) RemoveClaimableBalance(cBalance xdr.ClaimableBalanceEntry) (int64, error)
- func (q *Q) RemoveOffer(offerID int64, lastModifiedLedger uint32) (int64, error)
- func (q *Q) RemoveTrustLine(ledgerKey xdr.LedgerKeyTrustLine) (int64, error)
- func (q *Q) ReverseTrades() *TradesQ
- func (q *Q) SignersForAccounts(accounts []string) ([]AccountSigner, error)
- func (q *Q) Trades() *TradesQ
- func (q *Q) TradesForAssetPair(baseAssetId int64, counterAssetId int64) *TradesQ
- func (q *Q) TransactionByHash(dest interface{}, hash string) error
- func (q *Q) Transactions() *TransactionsQ
- func (q *Q) TransactionsByIDs(ids ...int64) (map[int64]Transaction, error)
- func (q *Q) TruncateExpingestStateTables() error
- func (q *Q) UpdateAccountData(entry xdr.LedgerEntry) (int64, error)
- func (q *Q) UpdateAssetStat(assetStat ExpAssetStat) (int64, error)
- func (q *Q) UpdateClaimableBalance(entry xdr.LedgerEntry) (int64, error)
- func (q *Q) UpdateExpIngestVersion(version int) error
- func (q *Q) UpdateExpStateInvalid(val bool) error
- func (q *Q) UpdateLastLedgerExpIngest(ledgerSequence uint32) error
- func (q *Q) UpdateOffer(offer Offer) (int64, error)
- func (q *Q) UpdateOfferCompactionSequence(sequence uint32) error
- func (q *Q) UpdateTrustLine(entry xdr.LedgerEntry) (int64, error)
- func (q *Q) UpsertAccounts(accounts []xdr.LedgerEntry) error
- func (q *Q) UpsertTrustLines(trustLines []xdr.LedgerEntry) error
- type QAccounts
- type QAssetStats
- type QClaimableBalances
- type QCreateAccountsHistory
- type QData
- type QEffects
- type QLedgers
- type QOffers
- type QOperations
- type QParticipants
- type QSigners
- type QTrades
- type QTransactions
- type QTrustLines
- type SequenceBumped
- type TimeBounds
- type TotalOrderID
- type Trade
- type TradeAggregation
- type TradeAggregationsQ
- type TradeBatchInsertBuilder
- type TradeEffectDetails
- type TradesQ
- type Transaction
- type TransactionBatchInsertBuilder
- type TransactionParticipantsBatchInsertBuilder
- type TransactionWithoutLedger
- type TransactionsQ
- type TrustLine
- type TrustLinesBatchInsertBuilder
Constants ¶
This section is empty.
Variables ¶
var AllowedResolutions = map[time.Duration]struct{}{ time.Minute: {}, time.Minute * 5: {}, time.Minute * 15: {}, time.Hour: {}, time.Hour * 24: {}, time.Hour * 24 * 7: {}, }
AllowedResolutions is the set of trade aggregation time windows allowed to be used as the `resolution` parameter.
var StrictResolutionFiltering = true
StrictResolutionFiltering represents a simple feature flag to determine whether only predetermined resolutions of trade aggregations are allowed.
Functions ¶
func EncodeOfferId ¶
func EncodeOfferId(id uint64, typ OfferIDType) int64
EncodeOfferId creates synthetic offer ids to be used by trade resources
This is required because aiblocks-core does not allocate offer ids for immediately filled offers, while clients expect them for aggregated views.
The encoded value is of type int64 for sql compatibility. The 2nd bit is used to differentiate between aiblocks-core offer ids and operation ids, which are toids.
Due to the 2nd bit being used, the largest possible toid is: 0011111111111111111111111111111100000000000000000001000000000001 \ ledger /\ transaction /\ op /
= 1073741823 with avg. 5 sec close time will reach in ~170 years
Types ¶
type AccountDataBatchInsertBuilder ¶
type AccountDataBatchInsertBuilder interface { Add(entry xdr.LedgerEntry) error Exec() error }
type AccountDataValue ¶
type AccountDataValue []byte
func (AccountDataValue) Base64 ¶
func (value AccountDataValue) Base64() string
func (*AccountDataValue) Scan ¶
func (t *AccountDataValue) Scan(src interface{}) error
Scan base64 decodes into an []byte
type AccountEntry ¶
type AccountEntry struct { AccountID string `db:"account_id"` Balance int64 `db:"balance"` BuyingLiabilities int64 `db:"buying_liabilities"` SellingLiabilities int64 `db:"selling_liabilities"` SequenceNumber int64 `db:"sequence_number"` NumSubEntries uint32 `db:"num_subentries"` InflationDestination string `db:"inflation_destination"` HomeDomain string `db:"home_domain"` Flags uint32 `db:"flags"` MasterWeight byte `db:"master_weight"` ThresholdLow byte `db:"threshold_low"` ThresholdMedium byte `db:"threshold_medium"` ThresholdHigh byte `db:"threshold_high"` LastModifiedLedger uint32 `db:"last_modified_ledger"` Sponsor null.String `db:"sponsor"` NumSponsored uint32 `db:"num_sponsored"` NumSponsoring uint32 `db:"num_sponsoring"` }
AccountEntry is a row of data from the `account` table
func (AccountEntry) IsAuthImmutable ¶
func (account AccountEntry) IsAuthImmutable() bool
IsAuthImmutable returns true if the account has the "AUTH_IMMUTABLE" option turned on.
func (AccountEntry) IsAuthRequired ¶
func (account AccountEntry) IsAuthRequired() bool
IsAuthRequired returns true if the account has the "AUTH_REQUIRED" option turned on.
func (AccountEntry) IsAuthRevocable ¶
func (account AccountEntry) IsAuthRevocable() bool
IsAuthRevocable returns true if the account has the "AUTH_REVOCABLE" option turned on.
type AccountSigner ¶
type AccountSigner struct { Account string `db:"account_id"` Signer string `db:"signer"` Weight int32 `db:"weight"` Sponsor null.String `db:"sponsor"` }
AccountSigner is a row of data from the `accounts_signers` table
type AccountSignersBatchInsertBuilder ¶
type AccountSignersBatchInsertBuilder interface { Add(signer AccountSigner) error Exec() error }
type AccountsBatchInsertBuilder ¶
type AccountsBatchInsertBuilder interface { Add(entry xdr.LedgerEntry) error Exec() error }
type Asset ¶
type Asset struct { ID int64 `db:"id"` Type string `db:"asset_type"` Code string `db:"asset_code"` Issuer string `db:"asset_issuer"` }
Asset is a row of data from the `history_assets` table
type ClaimableBalance ¶
type ClaimableBalance struct { BalanceID xdr.ClaimableBalanceId `db:"id"` Claimants Claimants `db:"claimants"` Asset xdr.Asset `db:"asset"` Amount xdr.Int64 `db:"amount"` Sponsor null.String `db:"sponsor"` LastModifiedLedger uint32 `db:"last_modified_ledger"` }
ClaimableBalance is a row of data from the `claimable_balances` table.
type ClaimableBalancesBatchInsertBuilder ¶
type ClaimableBalancesBatchInsertBuilder interface { Add(entry *xdr.LedgerEntry) error Exec() error }
type ClaimableBalancesQuery ¶
type ClaimableBalancesQuery struct { PageQuery db2.PageQuery Asset *xdr.Asset Sponsor *xdr.AccountId Claimant *xdr.AccountId }
ClaimableBalancesQuery is a helper struct to configure queries to claimable balances
func (ClaimableBalancesQuery) ApplyCursor ¶
func (cbq ClaimableBalancesQuery) ApplyCursor(sql sq.SelectBuilder) (sq.SelectBuilder, error)
ApplyCursor applies cursor to the given sql. For performance reason the limit is not apply here. This allows us to hint the planner later to use the right indexes.
func (ClaimableBalancesQuery) Cursor ¶
func (cbq ClaimableBalancesQuery) Cursor() (int64, *xdr.ClaimableBalanceId, error)
Cursor validates and returns the query page cursor
type Claimant ¶
type Claimant struct { Destination string `json:"destination"` Predicate xdr.ClaimPredicate `json:"predicate"` }
type Data ¶
type Data struct { AccountID string `db:"account_id"` Name string `db:"name"` Value AccountDataValue `db:"value"` LastModifiedLedger uint32 `db:"last_modified_ledger"` Sponsor null.String `db:"sponsor"` }
Data is a row of data from the `account_data` table
type Effect ¶
type Effect struct { HistoryAccountID int64 `db:"history_account_id"` Account string `db:"address"` HistoryOperationID int64 `db:"history_operation_id"` Order int32 `db:"order"` Type EffectType `db:"type"` DetailsString null.String `db:"details"` }
Effect is a row of data from the `history_effects` table
func (*Effect) LedgerSequence ¶
LedgerSequence return the ledger in which the effect occurred.
func (*Effect) PagingToken ¶
PagingToken returns a cursor for this effect
func (*Effect) UnmarshalDetails ¶
UnmarshalDetails unmarshals the details of this effect into `dest`
type EffectBatchInsertBuilder ¶
type EffectBatchInsertBuilder interface { Add( accountID int64, operationID int64, order uint32, effectType EffectType, details []byte, ) error Exec() error }
EffectBatchInsertBuilder is used to insert effects into the history_effects table
type EffectType ¶
type EffectType int
EffectType is the numeric type for an effect, used as the `type` field in the `history_effects` table.
const ( // EffectAccountCreated effects occur when a new account is created EffectAccountCreated EffectType = 0 // from create_account // EffectAccountRemoved effects occur when one account is merged into another EffectAccountRemoved EffectType = 1 // from merge_account // EffectAccountCredited effects occur when an account receives some currency EffectAccountCredited EffectType = 2 // from create_account, payment, path_payment, merge_account // EffectAccountDebited effects occur when an account sends some currency EffectAccountDebited EffectType = 3 // from create_account, payment, path_payment, create_account // EffectAccountThresholdsUpdated effects occur when an account changes its // multisig thresholds. EffectAccountThresholdsUpdated EffectType = 4 // from set_options // EffectAccountHomeDomainUpdated effects occur when an account changes its // home domain. EffectAccountHomeDomainUpdated EffectType = 5 // from set_options // EffectAccountFlagsUpdated effects occur when an account changes its // account flags, either clearing or setting. EffectAccountFlagsUpdated EffectType = 6 // from set_options // EffectAccountInflationDestinationUpdated effects occur when an account changes its // inflation destination. EffectAccountInflationDestinationUpdated EffectType = 7 // from set_options // EffectSignerCreated occurs when an account gains a signer EffectSignerCreated EffectType = 10 // from set_options // EffectSignerRemoved occurs when an account loses a signer EffectSignerRemoved EffectType = 11 // from set_options // EffectSignerUpdated occurs when an account changes the weight of one of its // signers. EffectSignerUpdated EffectType = 12 // from set_options // EffectTrustlineCreated occurs when an account trusts an anchor EffectTrustlineCreated EffectType = 20 // from change_trust // EffectTrustlineRemoved occurs when an account removes struct by setting the // limit of a trustline to 0 EffectTrustlineRemoved EffectType = 21 // from change_trust // EffectTrustlineUpdated occurs when an account changes a trustline's limit EffectTrustlineUpdated EffectType = 22 // from change_trust, allow_trust // EffectTrustlineAuthorized occurs when an anchor has AUTH_REQUIRED flag set // to true and it authorizes another account's trustline EffectTrustlineAuthorized EffectType = 23 // from allow_trust // it issues. EffectTrustlineDeauthorized EffectType = 24 // from allow_trust // EffectTrustlineAuthorizedToMaintainLiabilities occurs when an anchor has AUTH_REQUIRED flag set // to true and it authorizes another account's trustline to maintain liabilities EffectTrustlineAuthorizedToMaintainLiabilities EffectType = 25 // from allow_trust // EffectOfferCreated occurs when an account offers to trade an asset EffectOfferCreated EffectType = 30 // from manage_offer, creat_passive_offer // EffectOfferRemoved occurs when an account removes an offer EffectOfferRemoved EffectType = 31 // from manage_offer, creat_passive_offer, path_payment // EffectOfferUpdated occurs when an offer is updated by the offering account. EffectOfferUpdated EffectType = 32 // from manage_offer, creat_passive_offer, path_payment // EffectTrade occurs when a trade is initiated because of a path payment or // offer operation. EffectTrade EffectType = 33 // from manage_offer, creat_passive_offer, path_payment // EffectDataCreated occurs when an account gets a new data field EffectDataCreated EffectType = 40 // from manage_data // EffectDataRemoved occurs when an account removes a data field EffectDataRemoved EffectType = 41 // from manage_data // EffectDataUpdated occurs when an account changes a data field's value EffectDataUpdated EffectType = 42 // from manage_data // EffectSequenceBumped occurs when an account bumps their sequence number EffectSequenceBumped EffectType = 43 // from bump_sequence // EffectClaimableBalanceCreated occurs when a claimable balance is created EffectClaimableBalanceCreated EffectType = 50 // from create_claimable_balance // EffectClaimableBalanceClaimantCreated occurs when a claimable balance claimant is created EffectClaimableBalanceClaimantCreated EffectType = 51 // from create_claimable_balance // EffectClaimableBalanceClaimed occurs when a claimable balance is claimed EffectClaimableBalanceClaimed EffectType = 52 // from claim_claimable_balance // EffectAccountSponsorshipCreated occurs when an account ledger entry is sponsored EffectAccountSponsorshipCreated EffectType = 60 // from create_account // EffectAccountSponsorshipUpdated occurs when the sponsoring of an account ledger entry is updated EffectAccountSponsorshipUpdated EffectType = 61 // from revoke_sponsorship // EffectAccountSponsorshipRemoved occurs when the sponsorship of an account ledger entry is removed EffectAccountSponsorshipRemoved EffectType = 62 // from revoke_sponsorship // EffectTrustlineSponsorshipCreated occurs when a trustline ledger entry is sponsored EffectTrustlineSponsorshipCreated EffectType = 63 // from change_trust // EffectTrustlineSponsorshipUpdated occurs when the sponsoring of a trustline ledger entry is updated EffectTrustlineSponsorshipUpdated EffectType = 64 // from revoke_sponsorship // EffectTrustlineSponsorshipRemoved occurs when the sponsorship of a trustline ledger entry is removed EffectTrustlineSponsorshipRemoved EffectType = 65 // from revoke_sponsorship // EffectDataSponsorshipCreated occurs when a trustline ledger entry is sponsored EffectDataSponsorshipCreated EffectType = 66 // from manage_data // EffectDataSponsorshipUpdated occurs when the sponsoring of a trustline ledger entry is updated EffectDataSponsorshipUpdated EffectType = 67 // from revoke_sponsorship // EffectDataSponsorshipRemoved occurs when the sponsorship of a trustline ledger entry is removed EffectDataSponsorshipRemoved EffectType = 68 // from revoke_sponsorship // EffectClaimableBalanceSponsorshipCreated occurs when a claimable balance ledger entry is sponsored EffectClaimableBalanceSponsorshipCreated EffectType = 69 // from create_claimable_balance // EffectClaimableBalanceSponsorshipUpdated occurs when the sponsoring of a claimable balance ledger entry // is updated EffectClaimableBalanceSponsorshipUpdated EffectType = 70 // from revoke_sponsorship // EffectClaimableBalanceSponsorshipRemoved occurs when the sponsorship of a claimable balance ledger entry // is removed EffectClaimableBalanceSponsorshipRemoved EffectType = 71 // from claim_claimable_balance // EffectSignerSponsorshipCreated occurs when the sponsorship of a signer is created EffectSignerSponsorshipCreated EffectType = 72 // from set_options // EffectSignerSponsorshipUpdated occurs when the sponsorship of a signer is updated EffectSignerSponsorshipUpdated EffectType = 73 // from revoke_sponsorship // EffectSignerSponsorshipRemoved occurs when the sponsorship of a signer is removed EffectSignerSponsorshipRemoved EffectType = 74 // from revoke_sponsorship )
type EffectsQ ¶
type EffectsQ struct { Err error // contains filtered or unexported fields }
EffectsQ is a helper struct to aid in configuring queries that loads slices of Ledger structs.
func (*EffectsQ) ForAccount ¶
ForAccount filters the operations collection to a specific account
func (*EffectsQ) ForLedger ¶
ForLedger filters the query to only effects in a specific ledger, specified by its sequence.
func (*EffectsQ) ForOperation ¶
ForOperation filters the query to only effects in a specific operation, specified by its id.
func (*EffectsQ) ForTransaction ¶
ForTransaction filters the query to only effects in a specific transaction, specified by the transactions's hex-encoded hash.
type ExpAssetStat ¶
type ExpAssetStat struct { AssetType xdr.AssetType `db:"asset_type"` AssetCode string `db:"asset_code"` AssetIssuer string `db:"asset_issuer"` Amount string `db:"amount"` NumAccounts int32 `db:"num_accounts"` }
ExpAssetStat is a row in the exp_asset_stats table representing the stats per Asset
func (ExpAssetStat) PagingToken ¶
func (e ExpAssetStat) PagingToken() string
PagingToken returns a cursor for this asset stat
type FeeBumpFixture ¶
type FeeBumpFixture struct { Ledger Ledger Envelope xdr.TransactionEnvelope Transaction Transaction NormalTransaction Transaction OuterHash string InnerHash string }
FeeBumpFixture contains the data inserted into the database when running FeeBumpScenario
func FeeBumpScenario ¶
func FeeBumpScenario(tt *test.T, q *Q, successful bool) FeeBumpFixture
FeeBumpScenario creates a ledger containing a fee bump transaction, an operation, and an effect
type FeeStats ¶
type FeeStats struct { FeeChargedMax null.Int `db:"fee_charged_max"` FeeChargedMin null.Int `db:"fee_charged_min"` FeeChargedMode null.Int `db:"fee_charged_mode"` FeeChargedP10 null.Int `db:"fee_charged_p10"` FeeChargedP20 null.Int `db:"fee_charged_p20"` FeeChargedP30 null.Int `db:"fee_charged_p30"` FeeChargedP40 null.Int `db:"fee_charged_p40"` FeeChargedP50 null.Int `db:"fee_charged_p50"` FeeChargedP60 null.Int `db:"fee_charged_p60"` FeeChargedP70 null.Int `db:"fee_charged_p70"` FeeChargedP80 null.Int `db:"fee_charged_p80"` FeeChargedP90 null.Int `db:"fee_charged_p90"` FeeChargedP95 null.Int `db:"fee_charged_p95"` FeeChargedP99 null.Int `db:"fee_charged_p99"` MaxFeeMax null.Int `db:"max_fee_max"` MaxFeeMin null.Int `db:"max_fee_min"` MaxFeeMode null.Int `db:"max_fee_mode"` MaxFeeP10 null.Int `db:"max_fee_p10"` MaxFeeP20 null.Int `db:"max_fee_p20"` MaxFeeP30 null.Int `db:"max_fee_p30"` MaxFeeP40 null.Int `db:"max_fee_p40"` MaxFeeP50 null.Int `db:"max_fee_p50"` MaxFeeP60 null.Int `db:"max_fee_p60"` MaxFeeP70 null.Int `db:"max_fee_p70"` MaxFeeP80 null.Int `db:"max_fee_p80"` MaxFeeP90 null.Int `db:"max_fee_p90"` MaxFeeP95 null.Int `db:"max_fee_p95"` MaxFeeP99 null.Int `db:"max_fee_p99"` }
FeeStats is a row of data from the min, mode, percentile aggregate functions over the `history_transactions` table.
type IngestionQ ¶
type IngestionQ interface { QAccounts QAssetStats QClaimableBalances QData QEffects QLedgers QOffers QOperations // QParticipants // Copy the small interfaces with shared methods directly, otherwise error: // duplicate method CreateAccounts NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder QSigners //QTrades NewTradeBatchInsertBuilder(maxBatchSize int) TradeBatchInsertBuilder CreateAssets(assets []xdr.Asset, batchSize int) (map[string]Asset, error) QTransactions QTrustLines Begin() error BeginTx(*sql.TxOptions) error Commit() error CloneIngestionQ() IngestionQ Rollback() error GetTx() *sqlx.Tx GetExpIngestVersion() (int, error) UpdateExpStateInvalid(bool) error UpdateExpIngestVersion(int) error GetExpStateInvalid() (bool, error) GetLatestLedger() (uint32, error) GetOfferCompactionSequence() (uint32, error) TruncateExpingestStateTables() error DeleteRangeAll(start, end int64) error }
type InsertTrade ¶
type InsertTrade struct { HistoryOperationID int64 Order int32 LedgerCloseTime time.Time BuyOfferExists bool BuyOfferID int64 SellerAccountID int64 BuyerAccountID int64 SoldAssetID int64 BoughtAssetID int64 Trade xdr.ClaimOfferAtom SellPrice xdr.Price }
InsertTrade represents the arguments to TradeBatchInsertBuilder.Add() which is used to insert rows into the history_trades table
type LatestLedger ¶
LatestLedger represents a response from the raw LatestLedgerBaseFeeAndSequence query.
type Ledger ¶
type Ledger struct { TotalOrderID Sequence int32 `db:"sequence"` ImporterVersion int32 `db:"importer_version"` LedgerHash string `db:"ledger_hash"` PreviousLedgerHash null.String `db:"previous_ledger_hash"` TransactionCount int32 `db:"transaction_count"` SuccessfulTransactionCount *int32 `db:"successful_transaction_count"` FailedTransactionCount *int32 `db:"failed_transaction_count"` OperationCount int32 `db:"operation_count"` TxSetOperationCount *int32 `db:"tx_set_operation_count"` ClosedAt time.Time `db:"closed_at"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` TotalCoins int64 `db:"total_coins"` FeePool int64 `db:"fee_pool"` BaseFee int32 `db:"base_fee"` BaseReserve int32 `db:"base_reserve"` MaxTxSetSize int32 `db:"max_tx_set_size"` ProtocolVersion int32 `db:"protocol_version"` LedgerHeaderXDR null.String `db:"ledger_header"` }
Ledger is a row of data from the `history_ledgers` table
type LedgerCache ¶
LedgerCache is a helper struct to load ledger data related to a batch of sequences.
func (*LedgerCache) Load ¶
func (lc *LedgerCache) Load(q *Q) error
Load loads a batch of ledgers identified by `sequences`, using `q`, and populates the cache with the results
func (*LedgerCache) Queue ¶
func (lc *LedgerCache) Queue(seq int32)
Queue adds `seq` to the load queue for the cache.
type LedgerCapacityUsageStats ¶
LedgerCapacityUsageStats contains ledgers fullness stats.
type LedgersQ ¶
type LedgersQ struct { Err error // contains filtered or unexported fields }
LedgersQ is a helper struct to aid in configuring queries that loads slices of Ledger structs.
type ManageOffer ¶
type ManageOffer struct {
OfferID int64 `json:"offer_id"`
}
ManageOffer is a struct of data from `operations.DetailsString` when the operation type is manage sell offer or manage buy offer
type MockAccountDataBatchInsertBuilder ¶
func (*MockAccountDataBatchInsertBuilder) Add ¶
func (m *MockAccountDataBatchInsertBuilder) Add(entry xdr.LedgerEntry) error
func (*MockAccountDataBatchInsertBuilder) Exec ¶
func (m *MockAccountDataBatchInsertBuilder) Exec() error
type MockAccountSignersBatchInsertBuilder ¶
func (*MockAccountSignersBatchInsertBuilder) Add ¶
func (m *MockAccountSignersBatchInsertBuilder) Add(signer AccountSigner) error
func (*MockAccountSignersBatchInsertBuilder) Exec ¶
func (m *MockAccountSignersBatchInsertBuilder) Exec() error
type MockClaimableBalancesBatchInsertBuilder ¶
func (*MockClaimableBalancesBatchInsertBuilder) Add ¶
func (m *MockClaimableBalancesBatchInsertBuilder) Add(entry *xdr.LedgerEntry) error
func (*MockClaimableBalancesBatchInsertBuilder) Exec ¶
func (m *MockClaimableBalancesBatchInsertBuilder) Exec() error
type MockEffectBatchInsertBuilder ¶
MockEffectBatchInsertBuilder mock EffectBatchInsertBuilder
func (*MockEffectBatchInsertBuilder) Add ¶
func (m *MockEffectBatchInsertBuilder) Add( accountID int64, operationID int64, order uint32, effectType EffectType, details []byte, ) error
Add mock
func (*MockEffectBatchInsertBuilder) Exec ¶
func (m *MockEffectBatchInsertBuilder) Exec() error
Exec mock
type MockOffersBatchInsertBuilder ¶
func (*MockOffersBatchInsertBuilder) Add ¶
func (m *MockOffersBatchInsertBuilder) Add(row Offer) error
func (*MockOffersBatchInsertBuilder) Exec ¶
func (m *MockOffersBatchInsertBuilder) Exec() error
type MockOperationParticipantBatchInsertBuilder ¶
MockOperationParticipantBatchInsertBuilder OperationParticipantBatchInsertBuilder mock
func (*MockOperationParticipantBatchInsertBuilder) Add ¶
func (m *MockOperationParticipantBatchInsertBuilder) Add(operationID int64, accountID int64) error
Add mock
func (*MockOperationParticipantBatchInsertBuilder) Exec ¶
func (m *MockOperationParticipantBatchInsertBuilder) Exec() error
Exec mock
type MockOperationsBatchInsertBuilder ¶
MockOperationsBatchInsertBuilder OperationsBatchInsertBuilder mock
func (*MockOperationsBatchInsertBuilder) Add ¶
func (m *MockOperationsBatchInsertBuilder) Add( id int64, transactionID int64, applicationOrder uint32, operationType xdr.OperationType, details []byte, sourceAccount string, ) error
Add mock
func (*MockOperationsBatchInsertBuilder) Exec ¶
func (m *MockOperationsBatchInsertBuilder) Exec() error
Exec mock
type MockQAccounts ¶
MockQAccounts is a mock implementation of the QAccounts interface
func (*MockQAccounts) GetAccountsByIDs ¶
func (m *MockQAccounts) GetAccountsByIDs(ids []string) ([]AccountEntry, error)
func (*MockQAccounts) NewAccountsBatchInsertBuilder ¶
func (m *MockQAccounts) NewAccountsBatchInsertBuilder(maxBatchSize int) AccountsBatchInsertBuilder
func (*MockQAccounts) RemoveAccount ¶
func (m *MockQAccounts) RemoveAccount(accountID string) (int64, error)
func (*MockQAccounts) UpsertAccounts ¶
func (m *MockQAccounts) UpsertAccounts(accounts []xdr.LedgerEntry) error
type MockQAssetStats ¶
MockQAssetStats is a mock implementation of the QAssetStats interface
func (*MockQAssetStats) CountTrustLines ¶
func (m *MockQAssetStats) CountTrustLines() (int, error)
func (*MockQAssetStats) GetAssetStat ¶
func (m *MockQAssetStats) GetAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (ExpAssetStat, error)
func (*MockQAssetStats) GetAssetStats ¶
func (m *MockQAssetStats) GetAssetStats(assetCode, assetIssuer string, page db2.PageQuery) ([]ExpAssetStat, error)
func (*MockQAssetStats) InsertAssetStat ¶
func (m *MockQAssetStats) InsertAssetStat(assetStat ExpAssetStat) (int64, error)
func (*MockQAssetStats) InsertAssetStats ¶
func (m *MockQAssetStats) InsertAssetStats(assetStats []ExpAssetStat, batchSize int) error
func (*MockQAssetStats) RemoveAssetStat ¶
func (*MockQAssetStats) UpdateAssetStat ¶
func (m *MockQAssetStats) UpdateAssetStat(assetStat ExpAssetStat) (int64, error)
type MockQClaimableBalances ¶
MockQClaimableBalances is a mock implementation of the QAccounts interface
func (*MockQClaimableBalances) CountClaimableBalances ¶
func (m *MockQClaimableBalances) CountClaimableBalances() (int, error)
func (*MockQClaimableBalances) GetClaimableBalancesByID ¶
func (m *MockQClaimableBalances) GetClaimableBalancesByID(ids []xdr.ClaimableBalanceId) ([]ClaimableBalance, error)
func (*MockQClaimableBalances) NewClaimableBalancesBatchInsertBuilder ¶
func (m *MockQClaimableBalances) NewClaimableBalancesBatchInsertBuilder(maxBatchSize int) ClaimableBalancesBatchInsertBuilder
func (*MockQClaimableBalances) RemoveClaimableBalance ¶
func (m *MockQClaimableBalances) RemoveClaimableBalance(cBalance xdr.ClaimableBalanceEntry) (int64, error)
func (*MockQClaimableBalances) UpdateClaimableBalance ¶
func (m *MockQClaimableBalances) UpdateClaimableBalance(entry xdr.LedgerEntry) (int64, error)
type MockQData ¶
MockQData is a mock implementation of the QAccounts interface
func (*MockQData) CountAccountsData ¶
func (*MockQData) GetAccountDataByKeys ¶
func (m *MockQData) GetAccountDataByKeys(keys []xdr.LedgerKeyData) ([]Data, error)
func (*MockQData) InsertAccountData ¶
func (m *MockQData) InsertAccountData(entry xdr.LedgerEntry) (int64, error)
func (*MockQData) NewAccountDataBatchInsertBuilder ¶
func (m *MockQData) NewAccountDataBatchInsertBuilder(maxBatchSize int) AccountDataBatchInsertBuilder
func (*MockQData) RemoveAccountData ¶
func (m *MockQData) RemoveAccountData(key xdr.LedgerKeyData) (int64, error)
func (*MockQData) UpdateAccountData ¶
func (m *MockQData) UpdateAccountData(entry xdr.LedgerEntry) (int64, error)
type MockQEffects ¶
MockQEffects is a mock implementation of the QEffects interface
func (*MockQEffects) CreateAccounts ¶
func (*MockQEffects) NewEffectBatchInsertBuilder ¶
func (m *MockQEffects) NewEffectBatchInsertBuilder(maxBatchSize int) EffectBatchInsertBuilder
type MockQLedgers ¶
func (*MockQLedgers) InsertLedger ¶
func (m *MockQLedgers) InsertLedger( ledger xdr.LedgerHeaderHistoryEntry, successTxsCount int, failedTxsCount int, opCount int, txSetOpCount int, ingestVersion int, ) (int64, error)
type MockQOffers ¶
MockQOffers is a mock implementation of the QOffers interface
func (*MockQOffers) CompactOffers ¶
func (m *MockQOffers) CompactOffers(cutOffSequence uint32) (int64, error)
func (*MockQOffers) CountOffers ¶
func (m *MockQOffers) CountOffers() (int, error)
func (*MockQOffers) GetAllOffers ¶
func (m *MockQOffers) GetAllOffers() ([]Offer, error)
func (*MockQOffers) GetOffersByIDs ¶
func (m *MockQOffers) GetOffersByIDs(ids []int64) ([]Offer, error)
func (*MockQOffers) GetUpdatedOffers ¶
func (m *MockQOffers) GetUpdatedOffers(newerThanSequence uint32) ([]Offer, error)
func (*MockQOffers) NewOffersBatchInsertBuilder ¶
func (m *MockQOffers) NewOffersBatchInsertBuilder(maxBatchSize int) OffersBatchInsertBuilder
func (*MockQOffers) RemoveOffer ¶
func (m *MockQOffers) RemoveOffer(offerID int64, lastModifiedLedger uint32) (int64, error)
func (*MockQOffers) UpdateOffer ¶
func (m *MockQOffers) UpdateOffer(row Offer) (int64, error)
type MockQOperations ¶
MockQOperations is a mock implementation of the QOperations interface
func (*MockQOperations) NewOperationBatchInsertBuilder ¶
func (m *MockQOperations) NewOperationBatchInsertBuilder(maxBatchSize int) OperationBatchInsertBuilder
NewOperationBatchInsertBuilder mock
type MockQParticipants ¶
MockQParticipants is a mock implementation of the QParticipants interface
func (*MockQParticipants) CreateAccounts ¶
func (*MockQParticipants) NewOperationParticipantBatchInsertBuilder ¶
func (m *MockQParticipants) NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder
NewOperationParticipantBatchInsertBuilder mock
func (*MockQParticipants) NewTransactionParticipantsBatchInsertBuilder ¶
func (m *MockQParticipants) NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder
type MockQSigners ¶
func (*MockQSigners) AccountsForSigner ¶
func (m *MockQSigners) AccountsForSigner(signer string, page db2.PageQuery) ([]AccountSigner, error)
func (*MockQSigners) CountAccounts ¶
func (m *MockQSigners) CountAccounts() (int, error)
func (*MockQSigners) CreateAccountSigner ¶
func (*MockQSigners) GetLastLedgerExpIngest ¶
func (m *MockQSigners) GetLastLedgerExpIngest() (uint32, error)
func (*MockQSigners) GetLastLedgerExpIngestNonBlocking ¶
func (m *MockQSigners) GetLastLedgerExpIngestNonBlocking() (uint32, error)
func (*MockQSigners) NewAccountSignersBatchInsertBuilder ¶
func (m *MockQSigners) NewAccountSignersBatchInsertBuilder(maxBatchSize int) AccountSignersBatchInsertBuilder
func (*MockQSigners) RemoveAccountSigner ¶
func (m *MockQSigners) RemoveAccountSigner(account, signer string) (int64, error)
func (*MockQSigners) SignersForAccounts ¶
func (m *MockQSigners) SignersForAccounts(accounts []string) ([]AccountSigner, error)
func (*MockQSigners) UpdateLastLedgerExpIngest ¶
func (m *MockQSigners) UpdateLastLedgerExpIngest(ledgerSequence uint32) error
type MockQTrades ¶
func (*MockQTrades) CreateAccounts ¶
func (*MockQTrades) CreateAssets ¶
func (*MockQTrades) NewTradeBatchInsertBuilder ¶
func (m *MockQTrades) NewTradeBatchInsertBuilder(maxBatchSize int) TradeBatchInsertBuilder
type MockQTransactions ¶
MockQTransactions is a mock implementation of the QTransactions interface
func (*MockQTransactions) NewTransactionBatchInsertBuilder ¶
func (m *MockQTransactions) NewTransactionBatchInsertBuilder(maxBatchSize int) TransactionBatchInsertBuilder
type MockQTrustLines ¶
MockQTrustLines is a mock implementation of the QOffers interface
func (*MockQTrustLines) GetTrustLinesByKeys ¶
func (m *MockQTrustLines) GetTrustLinesByKeys(keys []xdr.LedgerKeyTrustLine) ([]TrustLine, error)
func (*MockQTrustLines) InsertTrustLine ¶
func (m *MockQTrustLines) InsertTrustLine(entry xdr.LedgerEntry) (int64, error)
func (*MockQTrustLines) NewTrustLinesBatchInsertBuilder ¶
func (m *MockQTrustLines) NewTrustLinesBatchInsertBuilder(maxBatchSize int) TrustLinesBatchInsertBuilder
func (*MockQTrustLines) RemoveTrustLine ¶
func (m *MockQTrustLines) RemoveTrustLine(key xdr.LedgerKeyTrustLine) (int64, error)
func (*MockQTrustLines) UpdateTrustLine ¶
func (m *MockQTrustLines) UpdateTrustLine(entry xdr.LedgerEntry) (int64, error)
func (*MockQTrustLines) UpsertTrustLines ¶
func (m *MockQTrustLines) UpsertTrustLines(trustLines []xdr.LedgerEntry) error
type MockTradeBatchInsertBuilder ¶
func (*MockTradeBatchInsertBuilder) Add ¶
func (m *MockTradeBatchInsertBuilder) Add(entries ...InsertTrade) error
func (*MockTradeBatchInsertBuilder) Exec ¶
func (m *MockTradeBatchInsertBuilder) Exec() error
type MockTransactionParticipantsBatchInsertBuilder ¶
MockTransactionParticipantsBatchInsertBuilder is a mock implementation of the TransactionParticipantsBatchInsertBuilder interface
func (*MockTransactionParticipantsBatchInsertBuilder) Add ¶
func (m *MockTransactionParticipantsBatchInsertBuilder) Add(transactionID, accountID int64) error
func (*MockTransactionParticipantsBatchInsertBuilder) Exec ¶
func (m *MockTransactionParticipantsBatchInsertBuilder) Exec() error
type MockTransactionsBatchInsertBuilder ¶
func (*MockTransactionsBatchInsertBuilder) Add ¶
func (m *MockTransactionsBatchInsertBuilder) Add(transaction io.LedgerTransaction, sequence uint32) error
func (*MockTransactionsBatchInsertBuilder) Exec ¶
func (m *MockTransactionsBatchInsertBuilder) Exec() error
type Offer ¶
type Offer struct { SellerID string `db:"seller_id"` OfferID int64 `db:"offer_id"` SellingAsset xdr.Asset `db:"selling_asset"` BuyingAsset xdr.Asset `db:"buying_asset"` Amount int64 `db:"amount"` Pricen int32 `db:"pricen"` Priced int32 `db:"priced"` Price float64 `db:"price"` Flags uint32 `db:"flags"` Deleted bool `db:"deleted"` LastModifiedLedger uint32 `db:"last_modified_ledger"` Sponsor null.String `db:"sponsor"` }
Offer is row of data from the `offers` table from millennium DB
type OfferIDType ¶
type OfferIDType uint64
const ( CoreOfferIDType OfferIDType = 0 TOIDType OfferIDType = 1 )
func DecodeOfferID ¶
func DecodeOfferID(encodedId int64) (uint64, OfferIDType)
DecodeOfferID performs the reverse operation of EncodeOfferID
type OffersQuery ¶
type OffersQuery struct { PageQuery db2.PageQuery SellerID string Sponsor string Selling *xdr.Asset Buying *xdr.Asset }
OffersQuery is a helper struct to configure queries to offers
type Operation ¶
type Operation struct { TotalOrderID TransactionID int64 `db:"transaction_id"` TransactionHash string `db:"transaction_hash"` TxResult string `db:"tx_result"` ApplicationOrder int32 `db:"application_order"` Type xdr.OperationType `db:"type"` DetailsString null.String `db:"details"` SourceAccount string `db:"source_account"` TransactionSuccessful bool `db:"transaction_successful"` }
Operation is a row of data from the `history_operations` table
func (*Operation) LedgerSequence ¶
LedgerSequence return the ledger in which the effect occurred.
func (*Operation) UnmarshalDetails ¶
UnmarshalDetails unmarshals the details of this operation into `dest`
type OperationBatchInsertBuilder ¶
type OperationBatchInsertBuilder interface { Add( id int64, transactionID int64, applicationOrder uint32, operationType xdr.OperationType, details []byte, sourceAccount string, ) error Exec() error }
OperationBatchInsertBuilder is used to insert a transaction's operations into the history_operations table
type OperationParticipantBatchInsertBuilder ¶
type OperationParticipantBatchInsertBuilder interface { Add( operationID int64, accountID int64, ) error Exec() error }
OperationParticipantBatchInsertBuilder is used to insert a transaction's operations into the history_operations table
type OperationsQ ¶
type OperationsQ struct { Err error // contains filtered or unexported fields }
OperationsQ is a helper struct to aid in configuring queries that loads slices of Operation structs.
func (*OperationsQ) Fetch ¶
func (q *OperationsQ) Fetch() ([]Operation, []Transaction, error)
Fetch returns results specified by a filtered operations query
func (*OperationsQ) ForAccount ¶
func (q *OperationsQ) ForAccount(aid string) *OperationsQ
ForAccount filters the operations collection to a specific account
func (*OperationsQ) ForLedger ¶
func (q *OperationsQ) ForLedger(seq int32) *OperationsQ
ForLedger filters the query to a only operations in a specific ledger, specified by its sequence.
func (*OperationsQ) ForTransaction ¶
func (q *OperationsQ) ForTransaction(hash string) *OperationsQ
ForTransaction filters the query to a only operations in a specific transaction, specified by the transactions's hex-encoded hash.
func (*OperationsQ) IncludeFailed ¶
func (q *OperationsQ) IncludeFailed() *OperationsQ
IncludeFailed changes the query to include failed transactions.
func (*OperationsQ) IncludeTransactions ¶
func (q *OperationsQ) IncludeTransactions() *OperationsQ
IncludeTransactions changes the query to fetch transaction data in addition to operation records.
func (*OperationsQ) OnlyPayments ¶
func (q *OperationsQ) OnlyPayments() *OperationsQ
OnlyPayments filters the query being built to only include operations that are in the "payment" class of operations: CreateAccountOps, Payments, and PathPayments.
func (*OperationsQ) Page ¶
func (q *OperationsQ) Page(page db2.PageQuery) *OperationsQ
Page specifies the paging constraints for the query being built by `q`.
type OrderBookSummary ¶
type OrderBookSummary struct { Asks []PriceLevel Bids []PriceLevel }
OrderBookSummary is a summary of a set of offers for a given base and counter currency
type PriceLevel ¶
PriceLevel represents an aggregation of offers to trade at a certain price.
type Q ¶
Q is a helper struct on which to hang common_trades queries against a history portion of the millennium database.
func (*Q) AccountByAddress ¶
AccountByAddress loads a row from `history_accounts`, by address
func (*Q) AccountEntriesForSigner ¶
AccountEntriesForSigner returns a list of `AccountEntry` rows for a given signer
func (*Q) AccountsByAddresses ¶
AccountsByAddresses loads a rows from `history_accounts`, by addresses
func (*Q) AccountsForAsset ¶
AccountsForAsset returns a list of `AccountEntry` rows who are trustee to an asset
func (*Q) AccountsForSigner ¶
AccountsForSigner returns a list of `AccountSigner` rows for a given signer
func (*Q) AccountsForSponsor ¶
AccountsForSponsor return all the accounts where `sponsor“ is sponsoring the account entry or any of its subentries (trust lines, signers, data, or account entry)
func (*Q) AssetsForAddress ¶
AssetsForAddress returns a list of assets and balances for those assets held by a given address.
func (*Q) CloneIngestionQ ¶
func (q *Q) CloneIngestionQ() IngestionQ
CloneIngestionQ clones underlying db.Session and returns IngestionQ
func (*Q) CompactOffers ¶
CompactOffers removes rows from the offers table which are marked for deletion.
func (*Q) CountAccounts ¶
func (*Q) CountAccountsData ¶
func (*Q) CountClaimableBalances ¶
CountClaimableBalances returns the total number of claimable balances in the DB
func (*Q) CountOffers ¶
func (*Q) CountTrustLines ¶
func (*Q) CreateAccountSigner ¶
func (q *Q) CreateAccountSigner(account, signer string, weight int32, sponsor *string) (int64, error)
CreateAccountSigner creates a row in the accounts_signers table. Returns number of rows affected and error.
func (*Q) CreateAccounts ¶
CreateAccounts creates rows in the history_accounts table for a given list of addresses. CreateAccounts returns a mapping of account address to its corresponding id in the history_accounts table
func (*Q) CreateAssets ¶
CreateAssets creates rows in the history_assets table for a given list of assets.
func (*Q) DeleteRangeAll ¶
DeleteRangeAll deletes a range of rows from all history tables between `start` and `end` (exclusive).
func (*Q) Effects ¶
Effects provides a helper to filter rows from the `history_effects` table with pre-defined filters. See `TransactionsQ` methods for the available filters.
func (*Q) ElderLedger ¶
ElderLedger loads the oldest ledger known to the history database
func (*Q) FeeStats ¶
FeeStats returns operation fee stats for the last 5 ledgers. Currently, we hard code the query to return the last 5 ledgers worth of transactions. TODO: make the number of ledgers configurable.
func (*Q) FindClaimableBalanceByID ¶
func (q *Q) FindClaimableBalanceByID(balanceID xdr.ClaimableBalanceId) (ClaimableBalance, error)
FindClaimableBalanceByID returns a claimable balance.
func (*Q) GetAccountByID ¶
func (q *Q) GetAccountByID(id string) (AccountEntry, error)
func (*Q) GetAccountDataByAccountID ¶
GetAccountDataByAccountID loads account data for a given account ID
func (*Q) GetAccountDataByAccountsID ¶
GetAccountDataByAccountsID loads account data for a list of account ID
func (*Q) GetAccountDataByKeys ¶
func (q *Q) GetAccountDataByKeys(keys []xdr.LedgerKeyData) ([]Data, error)
GetAccountDataByKeys loads a row from the `accounts_data` table, selected by multiple keys.
func (*Q) GetAccountDataByName ¶
GetAccountDataByName loads account data for a given account ID and data name
func (*Q) GetAccountSignersByAccountID ¶
func (q *Q) GetAccountSignersByAccountID(id string) ([]AccountSigner, error)
func (*Q) GetAccountsByIDs ¶
func (q *Q) GetAccountsByIDs(ids []string) ([]AccountEntry, error)
func (*Q) GetAllOffers ¶
GetAllOffers loads all non deleted offers
func (*Q) GetAssetID ¶
GetAssetID fetches the id for an Asset
func (*Q) GetAssetStat ¶
func (q *Q) GetAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (ExpAssetStat, error)
GetAssetStat returns a row in the exp_asset_stats table.
func (*Q) GetAssetStats ¶
func (q *Q) GetAssetStats(assetCode, assetIssuer string, page db2.PageQuery) ([]ExpAssetStat, error)
GetAssetStats returns a page of exp_asset_stats rows.
func (*Q) GetClaimableBalances ¶
func (q *Q) GetClaimableBalances(query ClaimableBalancesQuery) ([]ClaimableBalance, error)
GetClaimableBalances finds all claimable balances where accountID is one of the claimants
func (*Q) GetClaimableBalancesByID ¶
func (q *Q) GetClaimableBalancesByID(ids []xdr.ClaimableBalanceId) ([]ClaimableBalance, error)
GetClaimableBalancesByID finds all claimable balances by ClaimableBalanceId
func (*Q) GetExpIngestVersion ¶
GetExpIngestVersion returns the exp ingest version. Returns zero if there is no value.
func (*Q) GetExpStateInvalid ¶
GetExpStateInvalid returns true if the state was found to be invalid. Returns false otherwise.
func (*Q) GetLastLedgerExpIngest ¶
GetLastLedgerExpIngest returns the last ledger ingested by ingest system in Millennium. Returns ErrKeyNotFound error if no value has been previously set. This is using `SELECT ... FOR UPDATE` what means it's blocking the row for all other transactions.This behaviour is critical in distributed ingestion so do not change it unless you know what you are doing. The value can be set using UpdateLastLedgerExpIngest.
func (*Q) GetLastLedgerExpIngestNonBlocking ¶
GetLastLedgerExpIngestNonBlocking works like GetLastLedgerExpIngest but it does not block the value and does not return error if the value has not been previously set. This is used in status reporting (ex. in root resource of Millennium).
func (*Q) GetLatestLedger ¶
GetLatestLedger loads the latest known ledger. Returns 0 if no ledgers in `history_ledgers` table.
func (*Q) GetOfferByID ¶
GetOfferByID loads a row from the `offers` table, selected by offerid.
func (*Q) GetOfferCompactionSequence ¶
GetOfferCompactionSequence returns the sequence number corresponding to the last time the offers table was compacted.
func (*Q) GetOffers ¶
func (q *Q) GetOffers(query OffersQuery) ([]Offer, error)
GetOffers loads rows from `offers` by paging query.
func (*Q) GetOffersByIDs ¶
GetOffersByIDs loads a row from the `offers` table, selected by multiple offerid.
func (*Q) GetOrderBookSummary ¶
func (q *Q) GetOrderBookSummary(sellingAsset, buyingAsset xdr.Asset, maxPriceLevels int) (OrderBookSummary, error)
GetOrderBookSummary returns an OrderBookSummary for a given trading pair. GetOrderBookSummary should only be called in a repeatable read transaction.
func (*Q) GetSequenceNumbers ¶
func (*Q) GetSortedTrustLinesByAccountID ¶
func (*Q) GetSortedTrustLinesByAccountIDs ¶
GetSortedTrustLinesByAccountIDs loads trust lines for a list of accounts ID, ordered by asset and issuer
func (Q) GetTradeAggregationsQ ¶
func (q Q) GetTradeAggregationsQ(baseAssetID int64, counterAssetID int64, resolution int64, offset int64, pagingParams db2.PageQuery) (*TradeAggregationsQ, error)
GetTradeAggregationsQ initializes a TradeAggregationsQ query builder based on the required parameters
func (*Q) GetTrustLinesByKeys ¶
func (q *Q) GetTrustLinesByKeys(keys []xdr.LedgerKeyTrustLine) ([]TrustLine, error)
GetTrustLinesByKeys loads a row from the `trust_lines` table, selected by multiple keys.
func (*Q) GetUpdatedOffers ¶
GetUpdatedOffers returns all offers created, updated, or deleted after the given ledger sequence.
func (*Q) InsertAccountData ¶
func (q *Q) InsertAccountData(entry xdr.LedgerEntry) (int64, error)
InsertAccountData creates a row in the accounts_data table. Returns number of rows affected and error.
func (*Q) InsertAssetStat ¶
func (q *Q) InsertAssetStat(assetStat ExpAssetStat) (int64, error)
InsertAssetStat a single asset assetStat row into the exp_asset_stats Returns number of rows affected and error.
func (*Q) InsertAssetStats ¶
func (q *Q) InsertAssetStats(assetStats []ExpAssetStat, batchSize int) error
InsertAssetStats a set of asset stats into the exp_asset_stats
func (*Q) InsertLedger ¶
func (q *Q) InsertLedger( ledger xdr.LedgerHeaderHistoryEntry, successTxsCount int, failedTxsCount int, opCount int, txSetOpCount int, ingestVersion int, ) (int64, error)
InsertLedger creates a row in the history_ledgers table. Returns number of rows affected and error.
func (*Q) InsertTrustLine ¶
func (q *Q) InsertTrustLine(entry xdr.LedgerEntry) (int64, error)
InsertTrustLine creates a row in the trust lines table. Returns number of rows affected and error.
func (*Q) LatestLedger ¶
LatestLedger loads the latest known ledger
func (*Q) LatestLedgerBaseFeeAndSequence ¶
LatestLedgerBaseFeeAndSequence loads the latest known ledger's base fee and sequence number.
func (*Q) LedgerBySequence ¶
LedgerBySequence loads the single ledger at `seq` into `dest`
func (*Q) LedgerCapacityUsageStats ¶
func (q *Q) LedgerCapacityUsageStats(currentSeq int32, dest *LedgerCapacityUsageStats) error
LedgerCapacityUsageStats returns ledger capacity stats for the last 5 ledgers. Currently, we hard code the query to return the last 5 ledgers. TODO: make the number of ledgers configurable.
func (*Q) Ledgers ¶
Ledgers provides a helper to filter rows from the `history_ledgers` table with pre-defined filters. See `LedgersQ` methods for the available filters.
func (*Q) LedgersBySequence ¶
LedgersBySequence loads the a set of ledgers identified by the sequences `seqs` into `dest`.
func (*Q) NewAccountDataBatchInsertBuilder ¶
func (q *Q) NewAccountDataBatchInsertBuilder(maxBatchSize int) AccountDataBatchInsertBuilder
func (*Q) NewAccountSignersBatchInsertBuilder ¶
func (q *Q) NewAccountSignersBatchInsertBuilder(maxBatchSize int) AccountSignersBatchInsertBuilder
func (*Q) NewAccountsBatchInsertBuilder ¶
func (q *Q) NewAccountsBatchInsertBuilder(maxBatchSize int) AccountsBatchInsertBuilder
func (*Q) NewClaimableBalancesBatchInsertBuilder ¶
func (q *Q) NewClaimableBalancesBatchInsertBuilder(maxBatchSize int) ClaimableBalancesBatchInsertBuilder
NewClaimableBalancesBatchInsertBuilder constructs a new ClaimableBalancesBatchInsertBuilder instance
func (*Q) NewEffectBatchInsertBuilder ¶
func (q *Q) NewEffectBatchInsertBuilder(maxBatchSize int) EffectBatchInsertBuilder
NewEffectBatchInsertBuilder constructs a new EffectBatchInsertBuilder instance
func (*Q) NewOffersBatchInsertBuilder ¶
func (q *Q) NewOffersBatchInsertBuilder(maxBatchSize int) OffersBatchInsertBuilder
func (*Q) NewOperationBatchInsertBuilder ¶
func (q *Q) NewOperationBatchInsertBuilder(maxBatchSize int) OperationBatchInsertBuilder
NewOperationBatchInsertBuilder constructs a new TransactionBatchInsertBuilder instance
func (*Q) NewOperationParticipantBatchInsertBuilder ¶
func (q *Q) NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder
NewOperationParticipantBatchInsertBuilder constructs a new TransactionBatchInsertBuilder instance
func (*Q) NewTradeBatchInsertBuilder ¶
func (q *Q) NewTradeBatchInsertBuilder(maxBatchSize int) TradeBatchInsertBuilder
NewTradeBatchInsertBuilder constructs a new TradeBatchInsertBuilder instance
func (*Q) NewTransactionBatchInsertBuilder ¶
func (q *Q) NewTransactionBatchInsertBuilder(maxBatchSize int) TransactionBatchInsertBuilder
NewTransactionBatchInsertBuilder constructs a new TransactionBatchInsertBuilder instance
func (*Q) NewTransactionParticipantsBatchInsertBuilder ¶
func (q *Q) NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder
NewTransactionParticipantsBatchInsertBuilder constructs a new TransactionParticipantsBatchInsertBuilder instance
func (*Q) NewTrustLinesBatchInsertBuilder ¶
func (q *Q) NewTrustLinesBatchInsertBuilder(maxBatchSize int) TrustLinesBatchInsertBuilder
func (*Q) OperationByID ¶
OperationByID returns an Operation and optionally a Transaction given an operation id
func (*Q) Operations ¶
func (q *Q) Operations() *OperationsQ
Operations provides a helper to filter the operations table with pre-defined filters. See `OperationsQ` for the available filters.
func (*Q) RemoveAccount ¶
RemoveAccount deletes a row in the accounts table. Returns number of rows affected and error.
func (*Q) RemoveAccountData ¶
func (q *Q) RemoveAccountData(key xdr.LedgerKeyData) (int64, error)
RemoveAccountData deletes a row in the accounts_data table. Returns number of rows affected and error.
func (*Q) RemoveAccountSigner ¶
RemoveAccountSigner deletes a row in the accounts_signers table. Returns number of rows affected and error.
func (*Q) RemoveAssetStat ¶
RemoveAssetStat removes a row in the exp_asset_stats table.
func (*Q) RemoveClaimableBalance ¶
func (q *Q) RemoveClaimableBalance(cBalance xdr.ClaimableBalanceEntry) (int64, error)
RemoveClaimableBalance deletes a row in the claimable_balances table. Returns number of rows affected and error.
func (*Q) RemoveOffer ¶
RemoveOffer marks a row in the offers table as deleted. Returns number of rows affected and error.
func (*Q) RemoveTrustLine ¶
func (q *Q) RemoveTrustLine(ledgerKey xdr.LedgerKeyTrustLine) (int64, error)
RemoveTrustLine deletes a row in the trust lines table. Returns number of rows affected and error.
func (*Q) ReverseTrades ¶
ReverseTrades provides a helper to filter rows from the `history_trades` table with pre-defined filters and reversed base/counter. See `TradesQ` methods for the available filters.
func (*Q) SignersForAccounts ¶
func (q *Q) SignersForAccounts(accounts []string) ([]AccountSigner, error)
func (*Q) Trades ¶
Trades provides a helper to filter rows from the `history_trades` table with pre-defined filters. See `TradesQ` methods for the available filters.
func (*Q) TradesForAssetPair ¶
TradesForAssetPair provides a helper to filter rows from the `history_trades` table with the base filter of a specific asset pair. See `TradesQ` methods for further available filters.
func (*Q) TransactionByHash ¶
TransactionByHash is a query that loads a single row from the `history_transactions` table based upon the provided hash.
func (*Q) Transactions ¶
func (q *Q) Transactions() *TransactionsQ
Transactions provides a helper to filter rows from the `history_transactions` table with pre-defined filters. See `TransactionsQ` methods for the available filters.
func (*Q) TransactionsByIDs ¶
func (q *Q) TransactionsByIDs(ids ...int64) (map[int64]Transaction, error)
TransactionsByIDs fetches transactions from the `history_transactions` table which match the given ids
func (*Q) TruncateExpingestStateTables ¶
TruncateExpingestStateTables clears out ingestion state tables. Ingestion state tables are millennium database tables populated by the ingestion system using history archive snapshots. Any millennium database tables which cannot be populated using history archive snapshots will not be truncated.
func (*Q) UpdateAccountData ¶
func (q *Q) UpdateAccountData(entry xdr.LedgerEntry) (int64, error)
UpdateAccountData updates a row in the accounts_data table. Returns number of rows affected and error.
func (*Q) UpdateAssetStat ¶
func (q *Q) UpdateAssetStat(assetStat ExpAssetStat) (int64, error)
UpdateAssetStat updates a row in the exp_asset_stats table. Returns number of rows affected and error.
func (*Q) UpdateClaimableBalance ¶
func (q *Q) UpdateClaimableBalance(entry xdr.LedgerEntry) (int64, error)
UpdateClaimableBalance updates a row in the claimable_balances table. The only updatable value on claimable_balances is sponsor Returns number of rows affected and error.
func (*Q) UpdateExpIngestVersion ¶
UpdateExpIngestVersion updates the exp ingest version.
func (*Q) UpdateExpStateInvalid ¶
UpdateExpStateInvalid updates the state invalid value.
func (*Q) UpdateLastLedgerExpIngest ¶
UpdateLastLedgerExpIngest updates the last ledger ingested by ingest system. Can be read using GetLastLedgerExpIngest.
func (*Q) UpdateOffer ¶
UpdateOffer updates a row in the offers table. Returns number of rows affected and error.
func (*Q) UpdateOfferCompactionSequence ¶
UpdateOfferCompactionSequence sets the sequence number corresponding to the last time the offers table was compacted.
func (*Q) UpdateTrustLine ¶
func (q *Q) UpdateTrustLine(entry xdr.LedgerEntry) (int64, error)
UpdateTrustLine updates a row in the trust lines table. Returns number of rows affected and error.
func (*Q) UpsertAccounts ¶
func (q *Q) UpsertAccounts(accounts []xdr.LedgerEntry) error
UpsertAccounts upserts a batch of accounts in the accounts table. There's currently no limit of the number of accounts this method can accept other than 2GB limit of the query string length what should be enough for each ledger with the current limits.
func (*Q) UpsertTrustLines ¶
func (q *Q) UpsertTrustLines(trustLines []xdr.LedgerEntry) error
UpsertTrustLines upserts a batch of trust lines in the trust lines table. There's currently no limit of the number of trust lines this method can accept other than 2GB limit of the query string length what should be enough for each ledger with the current limits.
type QAccounts ¶
type QAccounts interface { NewAccountsBatchInsertBuilder(maxBatchSize int) AccountsBatchInsertBuilder GetAccountsByIDs(ids []string) ([]AccountEntry, error) UpsertAccounts(accounts []xdr.LedgerEntry) error RemoveAccount(accountID string) (int64, error) }
QAccounts defines account related queries.
type QAssetStats ¶
type QAssetStats interface { InsertAssetStats(stats []ExpAssetStat, batchSize int) error InsertAssetStat(stat ExpAssetStat) (int64, error) UpdateAssetStat(stat ExpAssetStat) (int64, error) GetAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (ExpAssetStat, error) RemoveAssetStat(assetType xdr.AssetType, assetCode, assetIssuer string) (int64, error) GetAssetStats(assetCode, assetIssuer string, page db2.PageQuery) ([]ExpAssetStat, error) CountTrustLines() (int, error) }
QAssetStats defines exp_asset_stats related queries.
type QClaimableBalances ¶
type QClaimableBalances interface { NewClaimableBalancesBatchInsertBuilder(maxBatchSize int) ClaimableBalancesBatchInsertBuilder UpdateClaimableBalance(entry xdr.LedgerEntry) (int64, error) RemoveClaimableBalance(cBalance xdr.ClaimableBalanceEntry) (int64, error) GetClaimableBalancesByID(ids []xdr.ClaimableBalanceId) ([]ClaimableBalance, error) CountClaimableBalances() (int, error) }
QClaimableBalances defines account related queries.
type QCreateAccountsHistory ¶
type QData ¶
type QData interface { NewAccountDataBatchInsertBuilder(maxBatchSize int) AccountDataBatchInsertBuilder CountAccountsData() (int, error) GetAccountDataByKeys(keys []xdr.LedgerKeyData) ([]Data, error) InsertAccountData(entry xdr.LedgerEntry) (int64, error) UpdateAccountData(entry xdr.LedgerEntry) (int64, error) RemoveAccountData(key xdr.LedgerKeyData) (int64, error) }
QData defines account data related queries.
type QEffects ¶
type QEffects interface { QCreateAccountsHistory NewEffectBatchInsertBuilder(maxBatchSize int) EffectBatchInsertBuilder }
QEffects defines history_effects related queries.
type QLedgers ¶
type QLedgers interface { InsertLedger( ledger xdr.LedgerHeaderHistoryEntry, successTxsCount int, failedTxsCount int, opCount int, txSetOpCount int, ingestVersion int, ) (int64, error) }
QLedgers defines ingestion ledger related queries.
type QOffers ¶
type QOffers interface { GetAllOffers() ([]Offer, error) GetOffersByIDs(ids []int64) ([]Offer, error) CountOffers() (int, error) GetUpdatedOffers(newerThanSequence uint32) ([]Offer, error) NewOffersBatchInsertBuilder(maxBatchSize int) OffersBatchInsertBuilder UpdateOffer(offer Offer) (int64, error) RemoveOffer(offerID int64, lastModifiedLedger uint32) (int64, error) CompactOffers(cutOffSequence uint32) (int64, error) }
QOffers defines offer related queries.
type QOperations ¶
type QOperations interface {
NewOperationBatchInsertBuilder(maxBatchSize int) OperationBatchInsertBuilder
}
QOperations defines history_operation related queries.
type QParticipants ¶
type QParticipants interface { QCreateAccountsHistory NewTransactionParticipantsBatchInsertBuilder(maxBatchSize int) TransactionParticipantsBatchInsertBuilder NewOperationParticipantBatchInsertBuilder(maxBatchSize int) OperationParticipantBatchInsertBuilder }
QParticipants defines ingestion participant related queries.
type QSigners ¶
type QSigners interface { GetLastLedgerExpIngestNonBlocking() (uint32, error) GetLastLedgerExpIngest() (uint32, error) UpdateLastLedgerExpIngest(ledgerSequence uint32) error AccountsForSigner(signer string, page db2.PageQuery) ([]AccountSigner, error) NewAccountSignersBatchInsertBuilder(maxBatchSize int) AccountSignersBatchInsertBuilder CreateAccountSigner(account, signer string, weight int32, sponsor *string) (int64, error) RemoveAccountSigner(account, signer string) (int64, error) SignersForAccounts(accounts []string) ([]AccountSigner, error) CountAccounts() (int, error) }
QSigners defines signer related queries.
type QTrades ¶
type QTrades interface { QCreateAccountsHistory NewTradeBatchInsertBuilder(maxBatchSize int) TradeBatchInsertBuilder CreateAssets(assets []xdr.Asset, maxBatchSize int) (map[string]Asset, error) }
type QTransactions ¶
type QTransactions interface {
NewTransactionBatchInsertBuilder(maxBatchSize int) TransactionBatchInsertBuilder
}
QTransactions defines transaction related queries.
type QTrustLines ¶
type QTrustLines interface { NewTrustLinesBatchInsertBuilder(maxBatchSize int) TrustLinesBatchInsertBuilder GetTrustLinesByKeys(keys []xdr.LedgerKeyTrustLine) ([]TrustLine, error) InsertTrustLine(entry xdr.LedgerEntry) (int64, error) UpdateTrustLine(entry xdr.LedgerEntry) (int64, error) UpsertTrustLines(entries []xdr.LedgerEntry) error RemoveTrustLine(key xdr.LedgerKeyTrustLine) (int64, error) }
QTrustLines defines trust lines related queries.
type SequenceBumped ¶
type SequenceBumped struct {
NewSeq int64 `json:"new_seq"`
}
SequenceBumped is a struct of data from `effects.DetailsString` when the effect type is sequence bumped.
type TimeBounds ¶
TimeBounds represents the time bounds of a AiBlocks transaction
func (*TimeBounds) Scan ¶
func (t *TimeBounds) Scan(src interface{}) error
Scan implements the database/sql Scanner interface.
type TotalOrderID ¶
type TotalOrderID struct {
ID int64 `db:"id"`
}
TotalOrderID represents the ID portion of rows that are identified by the "TotalOrderID". See total_order_id.go in the `db` package for details.
func (*TotalOrderID) PagingToken ¶
func (r *TotalOrderID) PagingToken() string
PagingToken returns a cursor for this record
type Trade ¶
type Trade struct { HistoryOperationID int64 `db:"history_operation_id"` Order int32 `db:"order"` LedgerCloseTime time.Time `db:"ledger_closed_at"` OfferID int64 `db:"offer_id"` BaseOfferID *int64 `db:"base_offer_id"` BaseAccount string `db:"base_account"` BaseAssetType string `db:"base_asset_type"` BaseAssetCode string `db:"base_asset_code"` BaseAssetIssuer string `db:"base_asset_issuer"` BaseAmount xdr.Int64 `db:"base_amount"` CounterOfferID *int64 `db:"counter_offer_id"` CounterAccount string `db:"counter_account"` CounterAssetType string `db:"counter_asset_type"` CounterAssetCode string `db:"counter_asset_code"` CounterAssetIssuer string `db:"counter_asset_issuer"` CounterAmount xdr.Int64 `db:"counter_amount"` BaseIsSeller bool `db:"base_is_seller"` PriceN null.Int `db:"price_n"` PriceD null.Int `db:"price_d"` }
Trade represents a trade from the trades table, joined with asset information from the assets table and account addresses from the accounts table
func (*Trade) PagingToken ¶
PagingToken returns a cursor for this trade
type TradeAggregation ¶
type TradeAggregation struct { Timestamp int64 `db:"timestamp"` TradeCount int64 `db:"count"` BaseVolume string `db:"base_volume"` CounterVolume string `db:"counter_volume"` Average float64 `db:"avg"` High xdr.Price `db:"high"` Low xdr.Price `db:"low"` Open xdr.Price `db:"open"` Close xdr.Price `db:"close"` }
TradeAggregation represents an aggregation of trades from the trades table
type TradeAggregationsQ ¶
type TradeAggregationsQ struct {
// contains filtered or unexported fields
}
TradeAggregationsQ is a helper struct to aid in configuring queries to bucket and aggregate trades
func (*TradeAggregationsQ) GetSql ¶
func (q *TradeAggregationsQ) GetSql() sq.SelectBuilder
GetSql generates a sql statement to aggregate Trades based on given parameters
func (*TradeAggregationsQ) WithEndTime ¶
func (q *TradeAggregationsQ) WithEndTime(endTime strtime.Millis) (*TradeAggregationsQ, error)
WithEndTime adds an upper optional time boundary filter to the trades being aggregated.
func (*TradeAggregationsQ) WithStartTime ¶
func (q *TradeAggregationsQ) WithStartTime(startTime strtime.Millis) (*TradeAggregationsQ, error)
WithStartTime adds an optional lower time boundary filter to the trades being aggregated.
type TradeBatchInsertBuilder ¶
type TradeBatchInsertBuilder interface { Add(entries ...InsertTrade) error Exec() error }
TradeBatchInsertBuilder is used to insert trades into the history_trades table
type TradeEffectDetails ¶
type TradeEffectDetails struct { Seller string `json:"seller"` OfferID int64 `json:"offer_id"` SoldAmount string `json:"sold_amount"` SoldAssetType string `json:"sold_asset_type"` SoldAssetCode string `json:"sold_asset_code,omitempty"` SoldAssetIssuer string `json:"sold_asset_issuer,omitempty"` BoughtAmount string `json:"bought_amount"` BoughtAssetType string `json:"bought_asset_type"` BoughtAssetCode string `json:"bought_asset_code,omitempty"` BoughtAssetIssuer string `json:"bought_asset_issuer,omitempty"` }
TradeEffectDetails is a struct of data from `effects.DetailsString` when the effect type is trade
type TradesQ ¶
type TradesQ struct { Err error // contains filtered or unexported fields }
TradesQ is a helper struct to aid in configuring queries that loads slices of trade structs.
func (*TradesQ) ForAccount ¶
ForAccount filter Trades by account id
type Transaction ¶
type Transaction struct { LedgerCloseTime time.Time `db:"ledger_close_time"` TransactionWithoutLedger }
Transaction is a row of data from the `history_transactions` table
type TransactionBatchInsertBuilder ¶
type TransactionBatchInsertBuilder interface { Add(transaction io.LedgerTransaction, sequence uint32) error Exec() error }
TransactionBatchInsertBuilder is used to insert transactions into the history_transactions table
type TransactionParticipantsBatchInsertBuilder ¶
type TransactionParticipantsBatchInsertBuilder interface { Add(transactionID, accountID int64) error Exec() error }
TransactionParticipantsBatchInsertBuilder is used to insert transaction participants into the history_transaction_participants table
type TransactionWithoutLedger ¶
type TransactionWithoutLedger struct { TotalOrderID TransactionHash string `db:"transaction_hash"` LedgerSequence int32 `db:"ledger_sequence"` ApplicationOrder int32 `db:"application_order"` Account string `db:"account"` AccountSequence string `db:"account_sequence"` MaxFee int64 `db:"max_fee"` FeeCharged int64 `db:"fee_charged"` OperationCount int32 `db:"operation_count"` TxEnvelope string `db:"tx_envelope"` TxResult string `db:"tx_result"` TxMeta string `db:"tx_meta"` TxFeeMeta string `db:"tx_fee_meta"` Signatures pq.StringArray `db:"signatures"` MemoType string `db:"memo_type"` Memo null.String `db:"memo"` TimeBounds TimeBounds `db:"time_bounds"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Successful bool `db:"successful"` FeeAccount null.String `db:"fee_account"` InnerTransactionHash null.String `db:"inner_transaction_hash"` NewMaxFee null.Int `db:"new_max_fee"` InnerSignatures pq.StringArray `db:"inner_signatures"` }
type TransactionsQ ¶
type TransactionsQ struct { Err error // contains filtered or unexported fields }
TransactionsQ is a helper struct to aid in configuring queries that loads slices of transaction structs.
func (*TransactionsQ) ForAccount ¶
func (q *TransactionsQ) ForAccount(aid string) *TransactionsQ
ForAccount filters the transactions collection to a specific account
func (*TransactionsQ) ForLedger ¶
func (q *TransactionsQ) ForLedger(seq int32) *TransactionsQ
ForLedger filters the query to a only transactions in a specific ledger, specified by its sequence.
func (*TransactionsQ) IncludeFailed ¶
func (q *TransactionsQ) IncludeFailed() *TransactionsQ
IncludeFailed changes the query to include failed transactions.
func (*TransactionsQ) Page ¶
func (q *TransactionsQ) Page(page db2.PageQuery) *TransactionsQ
Page specifies the paging constraints for the query being built by `q`.
func (*TransactionsQ) Select ¶
func (q *TransactionsQ) Select(dest interface{}) error
Select loads the results of the query specified by `q` into `dest`.
type TrustLine ¶
type TrustLine struct { AccountID string `db:"account_id"` AssetType xdr.AssetType `db:"asset_type"` AssetIssuer string `db:"asset_issuer"` AssetCode string `db:"asset_code"` Balance int64 `db:"balance"` Limit int64 `db:"trust_line_limit"` BuyingLiabilities int64 `db:"buying_liabilities"` SellingLiabilities int64 `db:"selling_liabilities"` Flags uint32 `db:"flags"` LastModifiedLedger uint32 `db:"last_modified_ledger"` Sponsor null.String `db:"sponsor"` }
TrustLine is row of data from the `trust_lines` table from millennium DB
func (TrustLine) IsAuthorized ¶
IsAuthorized returns true if issuer has authorized account to perform transactions with its credit
func (TrustLine) IsAuthorizedToMaintainLiabilities ¶
IsAuthorizedToMaintainLiabilities returns true if issuer has authorized the account to maintain liabilities with its credit
type TrustLinesBatchInsertBuilder ¶
type TrustLinesBatchInsertBuilder interface { Add(entry xdr.LedgerEntry) error Exec() error }
Source Files ¶
- account.go
- account_data.go
- account_data_batch_insert_builder.go
- account_data_value.go
- account_signers.go
- account_signers_batch_insert_builder.go
- accounts.go
- accounts_batch_insert_builder.go
- asset.go
- asset_stats.go
- claimable_balances.go
- effect.go
- effect_batch_insert_builder.go
- fee_bump_scenario.go
- ingestion.go
- key_value.go
- ledger.go
- ledger_cache.go
- main.go
- mock_account_data_batch_insert_builder.go
- mock_account_signers_batch_insert_builder.go
- mock_effect_batch_insert_builder.go
- mock_offers_batch_insert_builder.go
- mock_operation_participant_batch_insert_builder.go
- mock_operations_batch_insert_builder.go
- mock_q_accounts.go
- mock_q_asset_stats.go
- mock_q_claimable_balances.go
- mock_q_data.go
- mock_q_effects.go
- mock_q_ledgers.go
- mock_q_offers.go
- mock_q_operations.go
- mock_q_participants.go
- mock_q_signers.go
- mock_q_trades.go
- mock_q_transactions.go
- mock_q_trust_lines.go
- mock_transactions_batch_insert_builder.go
- offers.go
- offers_batch_insert_builder.go
- operation.go
- operation_batch_insert_builder.go
- operation_participant_batch_insert_builder.go
- orderbook.go
- participants.go
- sequence_provider.go
- sponsor.go
- synt_offer_id.go
- total_order_id.go
- trade.go
- trade_aggregation.go
- trade_batch_insert_builder.go
- transaction.go
- transaction_batch_insert_builder.go
- trust_lines.go
- trust_lines_batch_insert_builder.go