Documentation ¶
Index ¶
- type Postgres
- func (p *Postgres) Builder() *builder.Sqlbuilder
- func (p *Postgres) Close() error
- func (p *Postgres) DB() *sqlx.DB
- func (p *Postgres) Drop() error
- func (p *Postgres) Dump(path, filename string) error
- func (p *Postgres) Exists() error
- func (p *Postgres) Install() error
- func (p *Postgres) Migrate(version *sm.Version) error
- func (p *Postgres) Schema() string
- func (p *Postgres) Tables() ([]string, error)
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) Drop ¶
Drop
Drop deletes the database with the environments database name. Returns errors.INTERNAL if the exec command could not be ran.
func (*Postgres) Dump ¶
Dump
Dump the database to file with the given path and file name. Returns errors.INTERNAL if the connection, dump failed.
func (*Postgres) Exists ¶
Exists
CheckExists check's if the database exists. Returns errors.INVALID if the database was not found.
func (*Postgres) Install ¶
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.