postgresql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 9 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 WithConnectionURL

func WithConnectionURL(connectionURL string) Parameter

WithConnectionURL sets the connection URL for this module.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

type Service

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

Service is a chain 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) GetMetadata

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

GetMetadata obtains the JSON value from a metadata key.

func (*Service) SetAttestation

func (s *Service) SetAttestation(ctx context.Context, attestation *chaindb.Attestation) error

SetAttestation sets an attestation.

func (*Service) SetAttesterSlashing

func (s *Service) SetAttesterSlashing(ctx context.Context, attesterSlashing *chaindb.AttesterSlashing) error

SetAttesterSlashing sets an attester slashing.

func (*Service) SetBeaconCommittee

func (s *Service) SetBeaconCommittee(ctx context.Context, beaconCommittee *chaindb.BeaconCommittee) error

SetBeaconCommittee sets a beacon committee.

func (*Service) SetBlock

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

SetBlock sets a block.

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

func (s *Service) SetProposerDuty(ctx context.Context, proposerDuty *chaindb.ProposerDuty) error

SetProposerDuty sets a proposer duty.

func (*Service) SetProposerSlashing

func (s *Service) SetProposerSlashing(ctx context.Context, proposerSlashing *chaindb.ProposerSlashing) error

SetProposerSlashing sets a proposer slashing.

func (*Service) SetValidator

func (s *Service) SetValidator(ctx context.Context, validator *chaindb.Validator) error

SetValidator sets a validator.

func (*Service) SetValidatorBalance

func (s *Service) SetValidatorBalance(ctx context.Context, balance *chaindb.ValidatorBalance) error

SetValidatorBalance sets a validator's balance.

func (*Service) SetVoluntaryExit

func (s *Service) SetVoluntaryExit(ctx context.Context, voluntaryExit *chaindb.VoluntaryExit) error

SetVoluntaryExit sets a voluntary exit.

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