postgresql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTransaction is returned when an attempt to carry out a mutation to the database
	// is not inside a transaction.
	ErrNoTransaction = errors.New("no transaction for action")
)

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) BeginTx

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

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) SetBlock

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

SetBlock sets a block.

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) 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