postgres

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

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

Postgres defines the implementation of the database.Driver if Postgres is selected as the main driver.

func Setup

func Setup(env *environment.Env) (*Postgres, error)

Setup

New - Creates a new mySql instance and returns a new database driver. Returns errors.INVALID if there was an error establishing a connection or pinging.

func (*Postgres) Builder

func (p *Postgres) Builder() *builder.Sqlbuilder

Builder

Returns a new query builder instance.

func (*Postgres) Close

func (p *Postgres) Close() error

Close

Closes the MySQL connection.

func (*Postgres) DB

func (p *Postgres) DB() *sqlx.DB

DB

Returns the sqlx driver.

func (*Postgres) Drop

func (p *Postgres) Drop() error

Drop

Drop deletes the database with the environments database name. Returns errors.INTERNAL if the exec command could not be ran.

func (*Postgres) Dump

func (p *Postgres) Dump(path, filename string) error

Dump

Dump the database to file with the given path and file name. Returns errors.INTERNAL if the connection, dump failed.

func (*Postgres) Exists

func (p *Postgres) Exists() error

Exists

CheckExists check's if the database exists. Returns errors.INVALID if the database was not found.

func (*Postgres) Install

func (p *Postgres) Install() error

Install

Migrate the db by executing the Postgres migration file. Returns errors.INVALID if the sql file could not be located. Returns errors.INTERNAL if the exec command could not be ran.

func (*Postgres) Migrate added in v0.0.3

func (p *Postgres) Migrate(version *sm.Version) error

func (*Postgres) Schema

func (p *Postgres) Schema() string

Schema

Returns the schema (blank for MySQL),

func (*Postgres) Tables

func (p *Postgres) Tables() ([]string, error)

Jump to

Keyboard shortcuts

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