postgres

package
v0.0.0-...-f9f5cb3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GO_PG_PACKAGE = "/github.com/go-pg"
)

Variables

This section is empty.

Functions

func Conn

func Conn(writable bool) (dbConn *pg.DB, err error)

Get postgres connection

func ConnByContainer

func ConnByContainer(container string) (conn *pg.DB, err error)

Get postgres connection by container

func CreateMaster

func CreateMaster() (err error)

create new master connection

func CreateSlave

func CreateSlave() (err error)

create new slave connections

func NewQueryLogger

func NewQueryLogger()

Create new object of query logger

Types

type Debug

type Debug struct {
	DBConn *pg.DB
}

Debugger model contains DBConn on which query log will be created

func (*Debug) LogQuery

func (d *Debug) LogQuery()

Print postgresql query on terminal

type QueryLogger

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

Query log model contains method names and mux for locking

var (
	QL *QueryLogger
)

func (*QueryLogger) AddMethod

func (q *QueryLogger) AddMethod(methodName string)

Add methodName in queryLogger model

func (*QueryLogger) RemoveMethod

func (q *QueryLogger) RemoveMethod(methodName string)

Remove methodName from queryLogger model

Jump to

Keyboard shortcuts

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