postgres

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// threshold to switch to COPY for bulk inserting
	DefaultCopyThreshold = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handle(ctx context.Context, tx pgx.Tx, ev types.Event) error
}

type PGSink

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

func NewSink

func NewSink(cfg SinkConfig) (*PGSink, error)

func (*PGSink) LoadCursor

func (s *PGSink) LoadCursor(ctx context.Context, chainId string) (blockNum uint64, blockHash string, err error)

func (*PGSink) Migrate

func (s *PGSink) Migrate(ctx context.Context, sqlString string) error

func (*PGSink) MigrateWithFile

func (s *PGSink) MigrateWithFile(ctx context.Context, filePath string) error

func (*PGSink) Rollback

func (s *PGSink) Rollback(ctx context.Context, chainId string, toBlock uint64, blockHash string) (err error)

func (*PGSink) Store

func (s *PGSink) Store(ctx context.Context, events []types.Event) (err error)

func (*PGSink) UpdateCursor

func (s *PGSink) UpdateCursor(ctx context.Context, chainId string, newBlock uint64, blockHash string) error

type SinkConfig

type SinkConfig struct {
	Pool          *pgxpool.Pool
	Handler       Handler
	CopyThreshold int
	Metrics       metrics.Metrics
}

Jump to

Keyboard shortcuts

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