postgresql

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTransaction = errors.New("no transaction for action")

ErrNoTransaction is returned when an attempt to carry out a mutation to the database is not inside a transaction.

Functions

This section is empty.

Types

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithCACert

func WithCACert(cert []byte) Parameter

WithCACert sets the bytes of the certificate authority TLS certificate.

func WithClientCert

func WithClientCert(cert []byte) Parameter

WithClientCert sets the bytes of the client TLS certificate.

func WithClientKey

func WithClientKey(key []byte) Parameter

WithClientKey sets the bytes of the client TLS key.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithPassword

func WithPassword(password string) Parameter

WithPassword sets the password for this module.

func WithPort

func WithPort(port int32) Parameter

WithPort sets the port for this module.

func WithServer

func WithServer(server string) Parameter

WithServer sets the server for this module.

func WithUser

func WithUser(user string) Parameter

WithUser sets the user for this module.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is an execution database service.

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new service.

func (*Service) Balances added in v0.3.6

func (s *Service) Balances(ctx context.Context, filter *execdb.BalanceFilter) ([]*execdb.Balance, error)

Balances returns balances matching the supplied filter.

func (*Service) BeginTx

BeginTx begins a transaction on the database. The transaction can be rolled back by invoking the cancel function.

func (*Service) BlockRewards added in v0.5.1

func (s *Service) BlockRewards(ctx context.Context, filter *execdb.BlockRewardFilter) ([]*execdb.BlockReward, error)

BlockRewards returns block rewards matching the supplied filter.

func (*Service) Blocks added in v0.3.1

func (s *Service) Blocks(ctx context.Context, filter *execdb.BlockFilter) ([]*execdb.Block, error)

Blocks returns blocks matching the supplied filter.

func (*Service) CommitTx

func (s *Service) CommitTx(ctx context.Context) error

CommitTx commits a transaction on the ops datastore.

func (*Service) Events added in v0.1.1

func (s *Service) Events(ctx context.Context, filter *execdb.EventFilter) ([]*execdb.Event, error)

Events returns events matching the supplied filter.

func (*Service) Init

func (s *Service) Init(ctx context.Context) error

Init initialises the database.

func (*Service) Metadata

func (s *Service) Metadata(ctx context.Context, key string) ([]byte, error)

Metadata obtains the JSON value from a metadata key.

func (*Service) SetBalance added in v0.3.6

func (s *Service) SetBalance(ctx context.Context, balance *execdb.Balance) error

SetBalance sets a balance.

func (*Service) SetBalances added in v0.3.6

func (s *Service) SetBalances(ctx context.Context, balances []*execdb.Balance) error

SetBalances sets multiple balances efficiently.

func (*Service) SetBlock

func (s *Service) SetBlock(ctx context.Context, block *execdb.Block) error

SetBlock sets a block.

func (*Service) SetBlockReward added in v0.4.1

func (s *Service) SetBlockReward(ctx context.Context, reward *execdb.BlockReward) error

SetBlockReward sets a block's reward.

func (*Service) SetBlockRewards added in v0.4.1

func (s *Service) SetBlockRewards(ctx context.Context, rewards []*execdb.BlockReward) error

SetBlockRewards sets multiple block rewards efficiently.

func (*Service) SetBlocks

func (s *Service) SetBlocks(ctx context.Context, blocks []*execdb.Block) error

SetBlocks sets multiple blocks efficiently.

func (*Service) SetEvent

func (s *Service) SetEvent(ctx context.Context, event *execdb.Event) error

SetEvent sets an event.

func (*Service) SetEvents

func (s *Service) SetEvents(ctx context.Context, events []*execdb.Event) error

SetEvents sets multiple events efficiently.

func (*Service) SetMetadata

func (s *Service) SetMetadata(ctx context.Context, key string, value []byte) error

SetMetadata sets a metadata key to a JSON value.

func (*Service) SetTransaction

func (s *Service) SetTransaction(ctx context.Context, transaction *execdb.Transaction) error

SetTransaction sets a transaction.

func (*Service) SetTransactionStateDiff

func (s *Service) SetTransactionStateDiff(ctx context.Context, stateDiff *execdb.TransactionStateDiff) error

SetTransactionStateDiff sets a transaction's state differences.

func (*Service) SetTransactionStateDiffs

func (s *Service) SetTransactionStateDiffs(ctx context.Context, stateDiffs []*execdb.TransactionStateDiff) error

SetTransactionStateDiffs sets multiple transactions' state differences efficiently.

func (*Service) SetTransactions

func (s *Service) SetTransactions(ctx context.Context, transactions []*execdb.Transaction) error

SetTransactions sets multiple transactions efficiently

func (*Service) Transaction added in v0.3.1

func (s *Service) Transaction(ctx context.Context, hash []byte) (*execdb.Transaction, error)

Transaction returns the transaction matching the supplied hash.

func (*Service) TransactionBalanceChanges added in v0.4.9

func (s *Service) TransactionBalanceChanges(ctx context.Context, filter *execdb.TransactionBalanceChangeFilter) ([]*execdb.TransactionBalanceChange, error)

TransactionBalanceChanges returns transaction balance changes matching the supplied filter.

func (*Service) TransactionStateDiff added in v0.3.1

func (s *Service) TransactionStateDiff(ctx context.Context, hash []byte) (*execdb.TransactionStateDiff, error)

TransactionStateDiff returns transaction state diffs for the supplied hash.

func (*Service) Transactions

func (s *Service) Transactions(ctx context.Context, filter *execdb.TransactionFilter) ([]*execdb.Transaction, error)

Transactions returns transactions matching the supplied filter.

func (*Service) Upgrade

func (s *Service) Upgrade(ctx context.Context) error

Upgrade upgrades the database.

type Tx

type Tx struct{}

Tx is a context tag for the database transaction.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL