pgxgeom

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: MIT Imports: 10 Imported by: 9 modules, 3 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.

README

pgx-geom

PkgGoDev

Package pgx-geom provides PostGIS support for github.com/jackc/pgx/v5 via github.com/twpayne/go-geom.

Usage

Single connection
import (
    // ...

    "github.com/jackc/pgx/v5"
    "github.com/twpayne/go-geom"
    pgxgeom "github.com/twpayne/pgx-geom"
)

// ...

    connectionStr := os.Getenv("DATABASE_URL")
    conn, err := pgx.Connect(context.Background(), connectionStr)
    if err != nil {
        return err
    }
    if err := pgxgeom.Register(ctx, conn); err != nil {
        return err
    }
Connection pool
import (
    // ...

    "github.com/jackc/pgx/v5/pgxpool"
)

// ...

    config, err := pgxpool.ParseConfig(connectionStr)
    if err != nil {
        return err
    }
    config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
        if err := pgxgeom.Register(ctx, conn); err != nil {
            return err
        }
        return nil
    }

    pool, err := pgxpool.NewWithConfig(context.Background(), config)
    if err != nil {
        return err
    }

sqlc

See the sqlc documentation.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(ctx context.Context, conn *pgx.Conn) error

Register registers a codec for github.com/twpayne/go-geom.T types on conn.

Types

type GeomScanner added in v0.0.2

type GeomScanner interface {
	ScanGeom(v geom.T) error
}

GeomScanner enables PostGIS geometry/geography values to be scanned into arbitrary Go types. For more context, see section "Extending Existing PostgreSQL Type Support" of the README for jackc/pgx/v5/pgtype.

type GeomValuer added in v0.0.2

type GeomValuer interface {
	GeomValue() (geom.T, error)
}

GeomValuer enables PostGIS geometry/geography values to be marshaled from arbitrary Go types. For more context, see section "Extending Existing PostgreSQL Type Support" of the README for jackc/pgx/v5/pgtype.

Jump to

Keyboard shortcuts

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