postgres

package
v0.0.0-...-3423bc7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GormFromConf

func GormFromConf(conf *config.TomlConfig) (*gorm.DB, error)

GormFromConf - Creates new GORM connection based on passed DB configuration

func GormFromDbConn

func GormFromDbConn(db *sql.DB, debug bool) (*gorm.DB, error)

GormFromDbConn - Create a new Postgres GORM connection from existing postgres db connection

Types

type DBStore

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

DBStore - struct encapsulating database and logger

func NewDBStore

func NewDBStore(conf *config.TomlConfig) (*DBStore, error)

NewDBStore - Initializes database based on the config.Conf and returns new instance of DBStore

func (*DBStore) Close

func (d *DBStore) Close() error

Close - Closes the database connection.

func (*DBStore) ConnStatus

func (d *DBStore) ConnStatus() (codes.Code, error)

ConnStatus - Returns the connection status of database.

func (*DBStore) ConnStatusWithContext

func (d *DBStore) ConnStatusWithContext(ctx context.Context) (codes.Code, error)

ConnStatusWithContext - Returns the connection status of database. Times out if the passed context have a timeout specified.

func (*DBStore) DbRef

func (d *DBStore) DbRef() *sql.DB

DbRef - returns the encapsulated database reference.

Jump to

Keyboard shortcuts

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