postgresql

package
v0.1.14-update.7 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 4 Imported by: ? modules, 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

View Source
const EngineName = "pgx"

Variables

This section is empty.

Functions

func NewPostgreSQL

func NewPostgreSQL(dsn string) (sqldatabase.Engine, error)

NewPostgreSQL creates a new PostgreSQL engine instance. The dsn parameter is the data source name (e.g. postgres://db_user:mysecretpassword@localhost:5438/test?sslmode=disable). It returns a sqldatabase.Engine and an error, if any.

Types

type PostgreSQL

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

PostgreSQL represents the PostgreSQL engine.

func (PostgreSQL) Close

func (p PostgreSQL) Close() error

Close closes the connection to the PostgreSQL database. It returns an error, if any.

func (PostgreSQL) Dialect

func (p PostgreSQL) Dialect() string

Dialect returns the dialect of the PostgreSQL engine.

func (PostgreSQL) Query

func (p PostgreSQL) Query(ctx context.Context, query string, args ...any) ([]string, [][]string, error)

Query executes a query on the PostgreSQL engine. It takes a context.Context, a query string, and optional query arguments. It returns the column names, query results as a 2D slice of strings, and an error, if any.

func (PostgreSQL) TableInfo

func (p PostgreSQL) TableInfo(ctx context.Context, table string) (string, error)

TableInfo returns information about a specific table in the PostgreSQL database. It takes a context.Context and the name of the table. It returns the table name and an error, if any.

func (PostgreSQL) TableNames

func (p PostgreSQL) TableNames(ctx context.Context) ([]string, error)

TableNames returns the names of all tables in the PostgreSQL database. It takes a context.Context. It returns a slice of table names and an error, if any.

Jump to

Keyboard shortcuts

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