postgres

package
v0.0.0-...-663aea3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAgateStoreCloseError

func NewAgateStoreCloseError(err error) error

func NewDefaultStoreBatchOperationError

func NewDefaultStoreBatchOperationError(err error) error

NewDefaultStoreBatchOperationError is raised when a batch operation fails to be performed.

func NewDefaultStoreDatabaseConnectionError

func NewDefaultStoreDatabaseConnectionError(err error) error

NewDefaultStoreDatabaseConnectionError is raised if the default agate store cannot connect to the postgres database.

func NewDefaultStoreRelayListDecodingError

func NewDefaultStoreRelayListDecodingError(err error) error

NewDefaultStoreRelayListDecodingError is raised when the received relay list fails to be decoded in a go object.

func NewDefaultStoreRelayListingError

func NewDefaultStoreRelayListingError(err error) error

NewDefaultStoreRelayListingError is raised when the relays stored in the database can not be listed.

func NewDefaultStoreTransactionCommitError

func NewDefaultStoreTransactionCommitError(err error) error

NewDefaultStoreTransactionCommitError is raised when a transaction failed to be committed to the database.

func NewDefaultStoreTransactionExecutionError

func NewDefaultStoreTransactionExecutionError(err error) error

NewDefaultStoreTransactionExecutionError is raised when one of the sub-operation of a transaction has failed.

func NewDefaultStoreTransactionInitializationError

func NewDefaultStoreTransactionInitializationError(err error) error

NewDefaultStoreTransactionInitializationError is raised when the transaction object used to perform multiple operations in the database fails to be initialized.

func NewDefaultStoreTransactionRollbackError

func NewDefaultStoreTransactionRollbackError(err error) error

NewDefaultStoreTransactionRollbackError is raised when a rollback triggered by an error which occurred during a transaction execution fails to complete.

func NewNonInitializedTransactionerError

func NewNonInitializedTransactionerError(method string) error

NewNonInitializedTransactionerError creates an initialized NonInitializedTransactionerError given the name of the method attempting to perform the "unprotected" write operation in the database.

Types

type DefaultStore

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

The DefaultStore is an implementation of the Store which connects to a Postgres database to store the relay data.

func NewDefaultStore

func NewDefaultStore() *DefaultStore

NewDefaultStore creates an empty and non-initialized DefaultStore.

func (*DefaultStore) Close

func (store *DefaultStore) Close()

func (*DefaultStore) CreateBids

func (store *DefaultStore) CreateBids(ctx context.Context, bids []*models.Bid) error

func (*DefaultStore) CreateRelays

func (store *DefaultStore) CreateRelays(ctx context.Context, relays []*models.Relay) error

func (*DefaultStore) CreateSubmissions

func (store *DefaultStore) CreateSubmissions(ctx context.Context, submissions []*models.Submission) error

func (*DefaultStore) ExecInTx

func (store *DefaultStore) ExecInTx(ctx context.Context, fn func(store store.Store) error) error

func (*DefaultStore) Init

func (store *DefaultStore) Init(ctx context.Context, databaseURL string) error

Init initializes a DefaultStore given the postgres database URL.

func (*DefaultStore) ListRelays

func (store *DefaultStore) ListRelays(ctx context.Context) ([]models.Relay, error)

type NonInitializedTransactionerError

type NonInitializedTransactionerError struct {
	Method string
}

NonInitializedTransactionerError is the error raised by the store when it attempts to perform a write operation on the database which should have been wrapped in a transaction - which is not initialized, therefore causing the error.

func (*NonInitializedTransactionerError) Error

Jump to

Keyboard shortcuts

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