postgres

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MPL-2.0 Imports: 21 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func (p PgDatabase) Close()

func (PgDatabase) CopyFrom

func (p PgDatabase) CopyFrom(ctx context.Context, resources schema.Resources, shouldCascade bool, cascadeDeleteFilters map[string]interface{}) 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) 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 UUID

type UUID struct {
	pgtype.UUID
}

func (UUID) Get

func (dst 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