postgres

package
v0.14.7 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MPL-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, dsnURI string) (*pgxpool.Pool, error)

Connect connects to the given DSN and returns a pgxpool

Types

type PgDatabase

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

func NewPgDatabase

func NewPgDatabase(ctx context.Context, logger hclog.Logger, dsn string, sd schema.Dialect) (*PgDatabase, error)

func (PgDatabase) Begin added in v0.10.0

func (PgDatabase) Close

func (p PgDatabase) Close()

func (PgDatabase) CopyFrom

func (p PgDatabase) CopyFrom(ctx context.Context, resources schema.Resources, shouldCascade bool) error

CopyFrom copies all resources from []*Resource

func (PgDatabase) Delete

func (p PgDatabase) Delete(ctx context.Context, t *schema.Table, kvFilters []interface{}) error

func (PgDatabase) Dialect

func (p PgDatabase) Dialect() schema.Dialect

func (PgDatabase) Exec

func (p PgDatabase) Exec(ctx context.Context, query string, args ...interface{}) error

Exec allows executions of postgres queries with given args returning error of execution

func (PgDatabase) Insert

func (p PgDatabase) Insert(ctx context.Context, t *schema.Table, resources schema.Resources, shouldCascade bool) error

Insert inserts all resources to given table, table and resources are assumed from same table.

func (PgDatabase) Query

func (p PgDatabase) Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error)

Query allows execution of postgres queries with given args returning data result

func (PgDatabase) QueryOne

func (p PgDatabase) QueryOne(ctx context.Context, query string, args ...interface{}) pgx.Row

QueryOne allows execution of postgres queries with given args returning data result

func (PgDatabase) RawCopyFrom added in v0.7.4

func (p PgDatabase) RawCopyFrom(ctx context.Context, r io.Reader, sql string) error

func (PgDatabase) RawCopyTo added in v0.7.4

func (p PgDatabase) RawCopyTo(ctx context.Context, w io.Writer, sql string) error

func (PgDatabase) RemoveStaleData

func (p PgDatabase) RemoveStaleData(ctx context.Context, t *schema.Table, executionStart time.Time, kvFilters []interface{}) error

type PgTx added in v0.10.0

type PgTx struct {
	pgx.Tx
}

func (PgTx) Begin added in v0.10.0

func (p PgTx) Begin(ctx context.Context) (execution.TXQueryExecer, error)

func (PgTx) Exec added in v0.10.0

func (p PgTx) Exec(ctx context.Context, query string, args ...interface{}) error

type UUID

type UUID struct {
	pgtype.UUID
}

func (UUID) Get

func (u UUID) Get() interface{}

func (UUID) String

func (u UUID) String() string

Jump to

Keyboard shortcuts

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