pg

package
v0.0.0-...-8c83b81 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(postgresURI string) (*sql.DB, error)

Connect opens a database and verifies a connection to the database is alive, establishing a connection if necessary.

func IsDuplicate

func IsDuplicate(err error) (constraint string, ok bool)

IsDuplicate extracts a unique_constraint_violation from a database error.

func IsPLv8Error

func IsPLv8Error(err error) (msg string, ok bool)

IsPLv8Error extracts an error thrown by a PLv8 function.

func NewQueryBuilder

func NewQueryBuilder() sq.StatementBuilderType

NewQueryBuilder creates a new squirrel query builder with dollar placeholders

Types

type Error

type Error struct {
	Severity   string
	Code       string
	Message    string
	Constraint string
}

type Point

type Point struct {
	X, Y float64
}

Point is the representation of postgres type 'point' (x,y)

func (*Point) Scan

func (p *Point) Scan(src interface{}) error

Scan implements sql.Scanner and sets the X/Y coordinates of the point with the given src

func (Point) String

func (p Point) String() string

String implements the stringer interface and converts the point into the correct string display type

func (Point) Value

func (p Point) Value() (driver.Value, error)

Value implements driver.Valuer and coerces Point types into the native postgres 'point' type. It retains 15 digits of precision, as required for float8/double precision.

type Scannable

type Scannable interface {
	Scan(dest ...interface{}) error
}

Scannable matches the interface for the scannable sql.Row/sql.Rows

Jump to

Keyboard shortcuts

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