pgsql

package module
v0.0.0-...-bd61050 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB holds database connection pools

func InitDb

func InitDb(reader, writer DbConfig) *DB

InitDb Initialize database connection and mke sure database is reachable Conection Options: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING

func (*DB) BulkCopy

func (db *DB) BulkCopy(cntxt context.Context, conn *pgx.Conn, targetTable string, columns []string, rows [][]interface{}) (int64, error)

func (*DB) Conn

func (db *DB) Conn(readonly bool) *pgx.Conn

Conn provide reader or writer connection as per readonly state

type DbConfig

type DbConfig struct {
	DbHost string
	DbPort uint16
	DbName string
	DbUser string
	DbPwd  string
	//DbTimeout is Connection timeout in seconds
	//if could not connect to server in given time then giveup and raise error
	DbTimeout int
	//DbSSLMode flag to enable disable SSL for database connection
	DbSSLMode  string
	DbPoolSize uint16
}

DbConfig is config for disk persistent database (PostgreSQL)

Jump to

Keyboard shortcuts

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