postgres

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnInfo

type ColumnInfo struct {
	ColumnName string `db:"column_name"`
	IsPK       bool   `db:"is_pk"`
	TableName  string `db:"table_name"`
}

type Config

type Config struct {
	DBName string
	// contains filtered or unexported fields
}

func NewConfigFromEnv

func NewConfigFromEnv() (*Config, error)

func (*Config) GetKVConnectionString

func (cfg *Config) GetKVConnectionString() string

GetKVConnectionString returns libpq's connection string c.f) https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters

func (*Config) GetSearchPathOrPublic

func (cfg *Config) GetSearchPathOrPublic() string

type DB

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

func NewDB

func NewDB(db *sqlx.DB) *DB

func OpenPostgresDB

func OpenPostgresDB(cfg *Config) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) Exec

func (db *DB) Exec(query string) (sql.Result, error)

func (*DB) ExplainWithAnalyze

func (db *DB) ExplainWithAnalyze(query string) ([]string, error)

func (*DB) GetIndexes

func (db *DB) GetIndexes(database string, tables []string) ([]*IndexInfo, error)

func (*DB) GetTableColumns

func (db *DB) GetTableColumns(schema string, tables []string) ([]*ColumnInfo, error)

type IndexInfo

type IndexInfo struct {
	TableName string
	Columns   []string
}

Jump to

Keyboard shortcuts

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