pgconnector

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManagedSql

type ManagedSql struct {
	*sqlx.DB
}

ManagedSql wrapper that prevents users from closing the connection

func (ManagedSql) Close

func (m ManagedSql) Close() error

type PgConnector

type PgConnector struct {
	ConnectionString   string
	MaxOpenConnections int
	MaxIdleConnections int
	// contains filtered or unexported fields
}

PgConnector the simplest PG connector implementation with sqlx Start doesn't need to be explicitly called, but it is preferred to check connections

func (*PgConnector) CreateSchemaIfNotExists

func (p *PgConnector) CreateSchemaIfNotExists(ctx context.Context, schema string) error

CreateSchemaIfNotExists shorthand to create schema, if you don't want to do in manually

func (*PgConnector) GetConnection

func (p *PgConnector) GetConnection(ctx context.Context) (postgres.Connection, error)

func (*PgConnector) GetConnectionRaw

func (p *PgConnector) GetConnectionRaw(ctx context.Context) (*ManagedSql, error)

func (*PgConnector) Start

func (p *PgConnector) Start(ctx context.Context) error

func (*PgConnector) Stop

func (p *PgConnector) Stop(_ context.Context) error

Jump to

Keyboard shortcuts

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