postgresql

package
v1.13.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgreSQLStateStore

func NewPostgreSQLStateStore(logger logger.Logger) state.Store

NewPostgreSQLStateStore creates a new instance of PostgreSQL state store v2 with the default options. The v2 of the component uses a different format for storing data, always in a BYTEA column, which is more efficient than the JSONB column used in v1. Additionally, v2 uses random UUIDs for etags instead of the xmin column, expanding support to all Postgres-compatible databases such as CockroachDB, etc.

func NewPostgreSQLStateStoreWithOptions

func NewPostgreSQLStateStoreWithOptions(logger logger.Logger, opts Options) state.Store

NewPostgreSQLStateStoreWithOptions creates a new instance of PostgreSQL state store with options.

Types

type Options

type Options struct {
	// Disables support for authenticating with Azure AD
	// This should be set to "false" when targeting different databases than PostgreSQL (such as CockroachDB)
	NoAzureAD bool
}

type PostgreSQL

type PostgreSQL struct {
	state.BulkStore
	// contains filtered or unexported fields
}

PostgreSQL state store.

func (*PostgreSQL) BulkGet

func (p *PostgreSQL) BulkGet(parentCtx context.Context, req []state.GetRequest, _ state.BulkGetOpts) ([]state.BulkGetResponse, error)

func (*PostgreSQL) CleanupExpired

func (p *PostgreSQL) CleanupExpired() error

func (*PostgreSQL) Close

func (p *PostgreSQL) Close() error

Close implements io.Close.

func (*PostgreSQL) Delete

func (p *PostgreSQL) Delete(ctx context.Context, req *state.DeleteRequest) error

Delete removes an item from the state store.

func (*PostgreSQL) Features

func (p *PostgreSQL) Features() []state.Feature

Features returns the features available in this state store.

func (*PostgreSQL) Get

func (p *PostgreSQL) Get(parentCtx context.Context, req *state.GetRequest) (*state.GetResponse, error)

Get returns data from the database. If data does not exist for the key an empty state.GetResponse will be returned.

func (*PostgreSQL) GetCleanupInterval

func (p *PostgreSQL) GetCleanupInterval() *time.Duration

GetCleanupInterval returns the cleanupInterval property. This is primarily used for tests.

func (*PostgreSQL) GetComponentMetadata

func (p *PostgreSQL) GetComponentMetadata() (metadataInfo metadata.MetadataMap)

func (*PostgreSQL) GetDB

func (p *PostgreSQL) GetDB() *pgxpool.Pool

func (*PostgreSQL) Init

func (p *PostgreSQL) Init(ctx context.Context, meta state.Metadata) error

Init sets up Postgres connection and performs migrations

func (*PostgreSQL) Multi

func (p *PostgreSQL) Multi(parentCtx context.Context, request *state.TransactionalStateRequest) error

func (*PostgreSQL) Set

func (p *PostgreSQL) Set(ctx context.Context, req *state.SetRequest) error

Set makes an insert or update to the database.

Jump to

Keyboard shortcuts

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