database

package
v0.0.0-...-e48215e Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2022 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverPGX = "pgx"
	DriverPQ  = "postgres"
)

Variables

This section is empty.

Functions

func RunMigrations

func RunMigrations(dbConnString string, migrations []string) error

RunMigrations run all the migrations contained in "migrations" on the database pointed by dbConnString.

Types

type Instance

type Instance struct {
	DB *sqlx.DB
}

Instance contains a database connection instance.

func New

func New(connString string) (*Instance, error)

New returns an Instance connected to the database pointed by connString.

func NewWithDriver

func NewWithDriver(connString string, driver string) (*Instance, error)

NewWithDriver returns an Instance connected to the database pointed by connString with the given driver.

func (*Instance) Close

func (i *Instance) Close() error

Close closes the connection held by i.

func (*Instance) Exec

func (i *Instance) Exec(query string, params interface{}, dest interface{}) error

Exec executes query with the given params. If params is nil, query is assumed to be of the `SELECT` kind, and the resulting data will be written in dest.

Jump to

Keyboard shortcuts

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