db

package
v0.0.0-...-e2dd9e7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: Unlicense Imports: 5 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 {
	*sql.DB
}

Postgres contains objects for database communication.

func NewPostgres

func NewPostgres(config *PostgresConfig) (*Postgres, error)

NewPostgres create new database instance.

func (*Postgres) Exec

func (db *Postgres) Exec(query string, args ...interface{}) (bool, error)

Exec run sql query

func (*Postgres) QueryRow

func (db *Postgres) QueryRow(query string, args ...interface{}) (*sql.Rows, error)

QueryRow run sql query and expect return

func (*Postgres) RunFileQuery

func (db *Postgres) RunFileQuery(file string) error

RunFileQuery Run sql schema

func (*Postgres) Shutdown

func (db *Postgres) Shutdown()

Shutdown close connection

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	DbName   string
	SSL      string
}

PostgresConfig contains the configurations for database.

func NewPostgresConfig

func NewPostgresConfig() *PostgresConfig

NewPostgresConfig load the configuration for database.

func NewPostgresConfigMock

func NewPostgresConfigMock() *PostgresConfig

NewPostgresConfigMock load the configuration for database - USED FOR TEST.

Jump to

Keyboard shortcuts

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