Documentation
¶
Index ¶
- func AcceptedTransactionsByBlockHashes(ctx database.Context, blockHashes []string, ...) ([]*dbmodels.Transaction, error)
- func AcceptedTransactionsByBlockID(ctx database.Context, blockID uint64, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
- func AddressesByAddressStrings(ctx database.Context, addressStrings []string, ...) ([]*dbmodels.Address, error)
- func BlockByHash(ctx database.Context, blockHash string, preloadedFields ...dbmodels.FieldName) (*dbmodels.Block, error)
- func Blocks(ctx database.Context, order Order, skip uint64, limit uint64, ...) ([]*dbmodels.Block, error)
- func BlocksByHashes(ctx database.Context, hashes []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Block, error)
- func BlocksCount(ctx database.Context) (uint64, error)
- func BluestBlock(ctx database.Context) (*dbmodels.Block, error)
- func BulkInsert(ctx database.Context, objects []interface{}) error
- func DoesBlockExist(ctx database.Context, blockHash string) (bool, error)
- func SelectedTip(ctx database.Context) (*dbmodels.Block, error)
- func SelectedTipBlueScore(ctx database.Context) (uint64, error)
- func SubnetworksByIDs(ctx database.Context, subnetworkIDs []string, ...) ([]*dbmodels.Subnetwork, error)
- func TransactionByHash(ctx database.Context, transactionHash string, ...) (*dbmodels.Transaction, error)
- func TransactionByID(ctx database.Context, transactionID string, ...) (*dbmodels.Transaction, error)
- func TransactionOutputsByOutpoints(ctx database.Context, outpoints []*Outpoint) ([]*dbmodels.TransactionOutput, error)
- func TransactionsByAddress(ctx database.Context, address string, order Order, skip uint64, limit uint64, ...) ([]*dbmodels.Transaction, error)
- func TransactionsByAddressCount(ctx database.Context, address string) (uint64, error)
- func TransactionsByBlockHash(ctx database.Context, blockHash string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
- func TransactionsByHashes(ctx database.Context, transactionHashes []string, ...) ([]*dbmodels.Transaction, error)
- func TransactionsByIDs(ctx database.Context, transactionIDs []string, ...) ([]*dbmodels.Transaction, error)
- func TransactionsByIDsAndBlockHash(ctx database.Context, transactionIDs []string, blockHash string, ...) ([]*dbmodels.Transaction, error)
- func TransactionsByIDsAndBlockID(ctx database.Context, transactionIDs []string, blockID uint64, ...) ([]*dbmodels.Transaction, error)
- func UTXOsByAddress(ctx database.Context, address string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.TransactionOutput, error)
- func UpdateBlockAcceptingBlockID(ctx database.Context, blockID uint64, acceptingBlockID *uint64) error
- func UpdateBlockIsChainBlock(ctx database.Context, blockID uint64, isChainBlock bool) error
- func UpdateBlocksAcceptedByAcceptingBlock(ctx database.Context, currentAcceptingBlockID uint64, ...) error
- func UpdateTransactionAcceptingBlockID(ctx database.Context, transactionID uint64, acceptingBlockID *uint64) error
- func UpdateTransactionOutputIsSpent(ctx database.Context, txOutID uint64, isSpent bool) error
- type Order
- type Outpoint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptedTransactionsByBlockHashes ¶
func AcceptedTransactionsByBlockHashes(ctx database.Context, blockHashes []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
AcceptedTransactionsByBlockHashes retrieves a list of transactions that were accepted by blocks with the given `blockHashes`
func AcceptedTransactionsByBlockID ¶
func AcceptedTransactionsByBlockID(ctx database.Context, blockID uint64, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
AcceptedTransactionsByBlockID retrieves a list of transactions that were accepted by block with ID equal to `blockID` If preloadedFields was provided - preloads the requested fields
func AddressesByAddressStrings ¶
func AddressesByAddressStrings(ctx database.Context, addressStrings []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Address, error)
AddressesByAddressStrings retrieves all addresss by their address strings. If preloadedFields was provided - preloads the requested fields
func BlockByHash ¶
func BlockByHash(ctx database.Context, blockHash string, preloadedFields ...dbmodels.FieldName) (*dbmodels.Block, error)
BlockByHash retrieves a block from the database according to its hash If preloadedFields was provided - preloads the requested fields
func Blocks ¶
func Blocks(ctx database.Context, order Order, skip uint64, limit uint64, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Block, error)
Blocks retrieves from the database up to `limit` blocks in the requested `order`, skipping the first `skip` blocks If preloadedFields was provided - preloads the requested fields
func BlocksByHashes ¶
func BlocksByHashes(ctx database.Context, hashes []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Block, error)
BlocksByHashes retreives a list of blocks with the corresponding `hashes`
func BlocksCount ¶
BlocksCount returns the total number of blocks stored in the database
func BluestBlock ¶
BluestBlock fetches the block with the highest blue score from the database Note: this is not necessarily the same as SelectedTip(): In a non-fully synced Kasparov - chain is still partial, and therefore SelectedTip() returns a lower block.
func BulkInsert ¶
BulkInsert inserts a long list of objects into the database. Utilizes bulk insertion for much faster times.
func DoesBlockExist ¶
DoesBlockExist checks in the database whether a block with `blockHash` exists.
func SelectedTip ¶
SelectedTip fetches the selected tip from the database
func SelectedTipBlueScore ¶
SelectedTipBlueScore returns the blue score of the selected tip
func SubnetworksByIDs ¶
func SubnetworksByIDs(ctx database.Context, subnetworkIDs []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Subnetwork, error)
SubnetworksByIDs retrieves all subnetworks by their `subnetworkIDs`. If preloadedFields was provided - preloads the requested fields
func TransactionByHash ¶
func TransactionByHash(ctx database.Context, transactionHash string, preloadedFields ...dbmodels.FieldName) (*dbmodels.Transaction, error)
TransactionByHash retrieves a transaction from the database that has the provided hash If preloadedFields was provided - preloads the requested fields
func TransactionByID ¶
func TransactionByID(ctx database.Context, transactionID string, preloadedFields ...dbmodels.FieldName) (*dbmodels.Transaction, error)
TransactionByID retrieves a transaction from the database that has the provided ID If preloadedFields was provided - preloads the requested fields
func TransactionOutputsByOutpoints ¶
func TransactionOutputsByOutpoints(ctx database.Context, outpoints []*Outpoint) ([]*dbmodels.TransactionOutput, error)
TransactionOutputsByOutpoints retrieves all transaction outputs referenced by `outpoints`. If preloadedFields was provided - preloads the requested fields
func TransactionsByAddress ¶
func TransactionsByAddress(ctx database.Context, address string, order Order, skip uint64, limit uint64, preloadedFields ...dbmodels.FieldName) ( []*dbmodels.Transaction, error)
TransactionsByAddress retrieves up to `limit` transactions sent to or from `address`, in the requested `order`, skipping the first `skip` blocks If preloadedFields was provided - preloads the requested fields
func TransactionsByAddressCount ¶
TransactionsByAddressCount returns the total number of transactions sent to or from `address`
func TransactionsByBlockHash ¶
func TransactionsByBlockHash(ctx database.Context, blockHash string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
TransactionsByBlockHash retrieves a list of transactions included by the block with the given blockHash
func TransactionsByHashes ¶
func TransactionsByHashes(ctx database.Context, transactionHashes []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
TransactionsByHashes retrieves all transactions by their `transactionHashes`. If preloadedFields was provided - preloads the requested fields
func TransactionsByIDs ¶
func TransactionsByIDs(ctx database.Context, transactionIDs []string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
TransactionsByIDs retrieves all transactions by their `transactionIDs`. If preloadedFields was provided - preloads the requested fields
func TransactionsByIDsAndBlockHash ¶
func TransactionsByIDsAndBlockHash(ctx database.Context, transactionIDs []string, blockHash string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
TransactionsByIDsAndBlockHash retrieves all transactions in a block with the given hash by their `transactionIDs`. If preloadedFields was provided - preloads the requested fields
func TransactionsByIDsAndBlockID ¶
func TransactionsByIDsAndBlockID(ctx database.Context, transactionIDs []string, blockID uint64, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.Transaction, error)
TransactionsByIDsAndBlockID retrieves all transactions in a block with the given ID by their `transactionIDs`. If preloadedFields was provided - preloads the requested fields
func UTXOsByAddress ¶
func UTXOsByAddress(ctx database.Context, address string, preloadedFields ...dbmodels.FieldName) ([]*dbmodels.TransactionOutput, error)
UTXOsByAddress retrieves all transaction outputs incoming to `address`. If preloadedFields was provided - preloads the requested fields
func UpdateBlockAcceptingBlockID ¶
func UpdateBlockAcceptingBlockID(ctx database.Context, blockID uint64, acceptingBlockID *uint64) error
UpdateBlockAcceptingBlockID updates blocks with `blockID` to be accepted by `acceptingBlockID `. `acceptingBlockID` can be set nil.
func UpdateBlockIsChainBlock ¶
UpdateBlockIsChainBlock updates the block `blockID` by setting its isChainBlock field to `isChainBlock`
func UpdateBlocksAcceptedByAcceptingBlock ¶
func UpdateBlocksAcceptedByAcceptingBlock(ctx database.Context, currentAcceptingBlockID uint64, newAcceptingBlockID *uint64) error
UpdateBlocksAcceptedByAcceptingBlock updates all blocks which are currently accepted by `currentAcceptingBlockID` to be accepted by `newAcceptingBlockID`. `newAcceptingBlockID` can be set nil.
Types ¶
type Order ¶
type Order string
Order signifies the order at which results to a query are going to be returned.
Order constants
func StringToOrder ¶
StringToOrder converts an order string into an Order type. Returns OrderUnknown and an error if passed string is not ASC or DESC