psql

package
v0.0.0-...-6d0359b Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ssl    = "verify-ca"
	DB_SSL          = env.GetString("DB_SSL", "require")
	DB_NAME_LOG     = env.GetString("DB_NAME_LOG", "s3wf.log")
	DB_HOST_LOG     = env.GetString("DB_HOST_LOG", "localhost")
	DB_USER_LOG     = env.GetString("DB_USER_LOG", "postgres")
	DB_PASSWORD_LOG = env.GetString("DB_PASSWORD_LOG", "")
	DB_PORT_LOG     = env.GetString("DB_PORT_LOG", "5432")

	DB_RECONNECT  = env.GetInt("DB_RECONNECT", 10)
	DB_WAIT_START = env.GetBool("DB_WAIT_START", false)
)
View Source
var ConfigLog = config{
	DB_NAME_LOG,
	DB_HOST_LOG,
	DB_USER_LOG,
	DB_PASSWORD_LOG,
	DB_PORT_LOG,
	DB_SSL,
	source_log,
}
View Source
var (
	ErrDatabaseDown = errors.New("database down")
)

Functions

This section is empty.

Types

type ConnGroup

type ConnGroup struct {
	Log    *DbConnection
	Monge  *DbConnection
	Design *DbConnection
}

type DbConnection

type DbConnection struct {
	Once       *sync.Once
	Ctx        *context.Context
	ReopenConn chan bool
	IsWaiting  bool

	Conn   *pgxpool.Pool
	Config config
	// contains filtered or unexported fields
}

func NewConn

func NewConn(ctx *context.Context, conf config) *DbConnection

func (*DbConnection) Connect

func (c *DbConnection) Connect() error

func (*DbConnection) Exec

func (c *DbConnection) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)

func (*DbConnection) LoopCheckConnection

func (c *DbConnection) LoopCheckConnection()

func (*DbConnection) Query

func (c *DbConnection) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

func (*DbConnection) QueryFunc

func (c *DbConnection) QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)

func (*DbConnection) QueryRow

func (c *DbConnection) QueryRow(ctx context.Context, sql string, args ...interface{}) (pgx.Row, error)

func (*DbConnection) WaitForConnection

func (c *DbConnection) WaitForConnection()

Jump to

Keyboard shortcuts

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