postgres

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: MIT Imports: 9 Imported by: 0

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