pg

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoHostForTLS = errors.New("host server name must be provided when TLS is required")

Functions

func String

func String(s *string) string

String converts nullable strings to standard strings

Types

type Conn

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

Conn is a connection to a PostgreSQL database

func New

func New(o *Options) (*Conn, error)

New connects to a PostgreSQL database

func (*Conn) Close

func (c *Conn) Close() error

Close closes a connection

func (*Conn) Exec

func (c *Conn) Exec(sql string) error

Exec executes SQL statements

func (*Conn) InspectDatabase

func (c *Conn) InspectDatabase(o *InspectOptions) (db *ddl.Database, err error)

InspectDatabase describes the database

func (*Conn) ListChecks

func (c *Conn) ListChecks(schema, table string) ([]*ddl.Check, error)

ListChecks describes the check constraints of a database table

func (*Conn) ListColumns

func (c *Conn) ListColumns(schema, table string) ([]*ddl.Column, error)

ListColumns describes the columns of a database table

func (*Conn) ListForeignKeys

func (c *Conn) ListForeignKeys(schema, table string) ([]*ddl.ForeignKey, error)

ListForeignKeys describes a database table's dependencies on other tables

func (*Conn) ListFunctions

func (c *Conn) ListFunctions() ([]*ddl.Function, error)

ListFunctions describes the custom functions in the database

func (*Conn) ListIndexes

func (c *Conn) ListIndexes(schema, table string) ([]*ddl.Index, error)

ListIndexes describes the indexes of a database table

func (*Conn) ListParameters

func (c *Conn) ListParameters() (*ddl.Parameters, error)

ListParameters describes database configuration parameters

func (*Conn) ListSchemas

func (c *Conn) ListSchemas() ([]*ddl.Schema, error)

ListSchemas describes the schemas in the database

func (*Conn) ListTables

func (c *Conn) ListTables() ([]*ddl.Table, error)

ListTables describes the tables in the database

func (*Conn) ListTriggers

func (c *Conn) ListTriggers(schema, table string) ([]*ddl.Trigger, error)

ListTriggers describes the triggers of a database table

func (*Conn) ServerVersion

func (c *Conn) ServerVersion() (string, error)

ServerVersion queries the database host for its server version

type InspectOptions

type InspectOptions struct {
	SortChecks  bool
	SortColumns bool
	SortIndexes bool
}

type Options

type Options struct {
	Log *zap.SugaredLogger

	Host     string
	Port     uint16
	SSLMode  string
	Username string
	Password string
	Database string

	ConnectRetries int
}

Options contains settings for connecting to a PostgreSQL database

Jump to

Keyboard shortcuts

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