db

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(connStr string, overrides ...Overrideable) (*sqlx.DB, error)

Connect returns a SQLX database corresponding to the provided connection string/URL, env variables, and any provided overrides.

func CopyFromLines added in v0.4.0

func CopyFromLines(db *sqlx.DB, lines io.Reader, copyCmd string) (int64, error)

CopyFromLines bulk-loads data using the given copyCmd. lines must provide a set of complete lines of CSV data, including the end-of-line delimiters. Returns the number of rows inserted.

Types

type ErrInvalidSSLMode

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

ErrInvalidSSLMode is the error when the provided SSL mode is not one of the values that PostgreSQL supports.

func (*ErrInvalidSSLMode) Error

func (e *ErrInvalidSSLMode) Error() string

type OverrideDBName

type OverrideDBName string

OverrideDBName is a type for overriding the database name used to connect. To use it, one casts a string of the database name as an OverrideDBName

func (OverrideDBName) Override

func (o OverrideDBName) Override() string

type Overrideable

type Overrideable interface {
	Override() string
}

Overrideable is an interface for defining ways to override PG settings outside of the usual manners (through the connection string/URL or env vars). An example would be having specific flags that can be used to set database connect parameters.

Jump to

Keyboard shortcuts

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