bunpostgis

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 5 Imported by: 0

README

PostGIS support for Bun ORM

Build, Lint, Test Go Report Card

This module provides a simple wrapper that allows PostGIS geometry types to be used in Bun. It builds on the awesome ewkb support already in Orb.

Only pgx supported

Supports Point/MultiPoint, Linestring/MultiLinestring, Polygon/MultiPolygon.

Usage

Use it in a struct and tag the type appropriately if you want Bun to be able to create the table:

type SampleStruct struct {
	bun.BaseModel `bun:"bunpostgis_test_table"`
	GeoField      bunpostgis.PostgisGeometry `bun:"type:Geometry"`
	Name          string
}

See test/postgis_test.go for a full example

Testing

Tests have been refactored into their own package to avoid unessesary imports when using the library.

This test expects Postgres environment variables to be present to configure the database connection -- intended mostly for CI.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgisGeometry

type PostgisGeometry struct {
	orb.Geometry
	SRID int
}

func (*PostgisGeometry) Scan

func (g *PostgisGeometry) Scan(value interface{}) error

func (*PostgisGeometry) Value

func (g *PostgisGeometry) Value() (driver.Value, error)

Directories

Path Synopsis
pkg module

Jump to

Keyboard shortcuts

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