pgarray

package
v0.34.13 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

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

Array adapts a string-kind slice (plain or named, e.g. `type Selection []string`) to PostgreSQL text[] over database/sql, implementing both driver.Valuer (bind) and sql.Scanner (scan).

It replaces lib/pq's pq.Array, which the platform no longer depends on: GO-2026-6166..6173 flag lib/pq with no fixed release available, and the driver was vestigial (pgx/v5 stdlib has been the actual driver all along — lib/pq was linked only for these helpers). The bind format is byte-identical to pq's ({"a","b"} — every element quoted); the parser additionally accepts PostgreSQL's own output form ({a,b}), so row fixtures and driver output both scan.

Scope is deliberately strings-only — every array column in the schema (architectures, selection, domains, CIDRs, bases) is text[]. Numeric arrays would need this generalized; don't until one exists.

func New

func New(v any) *Array

New wraps a string-kind slice for BINDING as a text[] argument. Accepts the slice directly or a pointer to it.

func (*Array) Scan

func (a *Array) Scan(src any) error

Scan implements sql.Scanner: parses PostgreSQL text[] literal form into the wrapped destination slice.

func (*Array) Value

func (a *Array) Value() (driver.Value, error)

Value implements driver.Valuer: renders the wrapped slice as a PostgreSQL text[] literal. A nil slice binds as NULL.

Jump to

Keyboard shortcuts

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