postgres

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package postgres reads PostgreSQL-specific values and errors through database/sql without requiring a driver dependency.

Index

Constants

View Source
const SqlStateUniqueViolation = "23505"

SqlStateUniqueViolation is the SQLSTATE code of unique constraint violations.

Variables

View Source
var ErrMalformedTextArray = errors.New("malformed text array")

Functions

func ParseTextArray

func ParseTextArray(data string) ([]string, error)

ParseTextArray parses the output format of a one-dimensional PostgreSQL text array.

func SqlState

func SqlState(err error) (string, bool)

SqlState returns the PostgreSQL SQLSTATE code carried by err, or false when err carries none.

Types

type TextArrayScanner

type TextArrayScanner struct {
	Target *[]string
}

TextArrayScanner scans a one-dimensional PostgreSQL text array in its output format ("{a,b,...}", elements double-quoted with backslash escaping when needed) into Target. A SQL NULL scans as nil; null array elements are rejected.

func (TextArrayScanner) Scan

func (s TextArrayScanner) Scan(value any) error

Jump to

Keyboard shortcuts

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