pgeo

package
v4.0.0-...-6aec9a5 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package pgeo implements geometric types for Postgres

Geometric types: https://www.postgresql.org/docs/current/static/datatype-geometric.html

Description: https://github.com/saulortega/pgeo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box [2]Point

Box is represented by pairs of points that are opposite corners of the box.

func NewBox

func NewBox(A, B Point) Box

NewBox creates a box

func (*Box) Randomize

func (b *Box) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Box) Scan

func (b *Box) Scan(src interface{}) error

Scan from sql query

func (Box) Value

func (b Box) Value() (driver.Value, error)

Value for the database

type Circle

type Circle struct {
	Point
	Radius float64 `json:"radius"`
}

Circle is represented by a center point and radius.

func NewCircle

func NewCircle(P Point, R float64) Circle

NewCircle creates a circle from a radius and a point

func (*Circle) Randomize

func (c *Circle) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Circle) Scan

func (c *Circle) Scan(src interface{}) error

Scan from sql query

func (Circle) Value

func (c Circle) Value() (driver.Value, error)

Value for the database

type Line

type Line struct {
	A float64 `json:"a"`
	B float64 `json:"b"`
	C float64 `json:"c"`
}

Line represents a infinite line with the linear equation Ax + By + C = 0, where A and B are not both zero.

func NewLine

func NewLine(A, B, C float64) Line

NewLine creates a line

func (*Line) Randomize

func (l *Line) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Line) Scan

func (l *Line) Scan(src interface{}) error

Scan from sql query

func (Line) Value

func (l Line) Value() (driver.Value, error)

Value for database

type Lseg

type Lseg [2]Point

Lseg is a line segment and is represented by pairs of points that are the endpoints of the segment.

func NewLseg

func NewLseg(A, B Point) Lseg

NewLseg creates a line segment

func (*Lseg) Randomize

func (l *Lseg) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Lseg) Scan

func (l *Lseg) Scan(src interface{}) error

Scan from sql query

func (Lseg) Value

func (l Lseg) Value() (driver.Value, error)

Value for the database

type NullBox

type NullBox struct {
	Box
	Valid bool `json:"valid"`
}

NullBox allows a box to be null

func NewNullBox

func NewNullBox(B Box, v bool) NullBox

NewNullBox creates a box which can be null

func (*NullBox) Randomize

func (b *NullBox) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullBox) Scan

func (b *NullBox) Scan(src interface{}) error

Scan from sql query

func (NullBox) Value

func (b NullBox) Value() (driver.Value, error)

Value for the database

type NullCircle

type NullCircle struct {
	Circle
	Valid bool `json:"valid"`
}

NullCircle allows circle to be null

func NewNullCircle

func NewNullCircle(C Circle, v bool) NullCircle

NewNullCircle creates a circle which can be null

func (*NullCircle) Randomize

func (c *NullCircle) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullCircle) Scan

func (c *NullCircle) Scan(src interface{}) error

Scan from sql query

func (NullCircle) Value

func (c NullCircle) Value() (driver.Value, error)

Value for database

type NullLine

type NullLine struct {
	Line
	Valid bool `json:"valid"`
}

NullLine allows line to be null

func NewNullLine

func NewNullLine(L Line, v bool) NullLine

NewNullLine creates a line which can be null

func (*NullLine) Randomize

func (l *NullLine) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullLine) Scan

func (l *NullLine) Scan(src interface{}) error

Scan from sql query

func (NullLine) Value

func (l NullLine) Value() (driver.Value, error)

Value for database

type NullLseg

type NullLseg struct {
	Lseg
	Valid bool `json:"valid"`
}

NullLseg allows line segment to be null

func NewNullLseg

func NewNullLseg(L Lseg, v bool) NullLseg

NewNullLseg creates a line segment which can be null

func (*NullLseg) Randomize

func (l *NullLseg) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullLseg) Scan

func (l *NullLseg) Scan(src interface{}) error

Scan from sql query

func (NullLseg) Value

func (l NullLseg) Value() (driver.Value, error)

Value for database

type NullPath

type NullPath struct {
	Path
	Valid bool `json:"valid"`
}

NullPath allows path to be null

func NewNullPath

func NewNullPath(P Path, v bool) NullPath

NewNullPath creates a path which can be null

func (*NullPath) Randomize

func (p *NullPath) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullPath) Scan

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

Scan from sql query

func (NullPath) Value

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

Value for database

type NullPoint

type NullPoint struct {
	Point
	Valid bool `json:"valid"`
}

NullPoint allows point to be null

func NewNullPoint

func NewNullPoint(P Point, v bool) NullPoint

NewNullPoint creates a point which can be null

func (*NullPoint) Randomize

func (p *NullPoint) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullPoint) Scan

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

Scan from sql query

func (NullPoint) Value

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

Value for database

type NullPolygon

type NullPolygon struct {
	Polygon
	Valid bool `json:"valid"`
}

NullPolygon allows polygon to be null

func NewNullPolygon

func NewNullPolygon(P Polygon, v bool) NullPolygon

NewNullPolygon creates a polygon which can be null

func (*NullPolygon) Randomize

func (p *NullPolygon) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*NullPolygon) Scan

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

Scan from sql query

func (NullPolygon) Value

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

Value for database

type Path

type Path struct {
	Points []Point
	Closed bool `json:"closed"`
}

Path is represented by lists of connected points. Paths can be open, where the first and last points in the list are considered not connected, or closed, where the first and last points are considered connected.

func NewPath

func NewPath(P []Point, C bool) Path

NewPath creates a path

func (*Path) Randomize

func (p *Path) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Path) Scan

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

Scan from sql query

func (Path) Value

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

Value for database

type Point

type Point struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Point is the fundamental two-dimensional building block for geometric types. X and Y are the respective coordinates, as floating-point numbers

func NewPoint

func NewPoint(X, Y float64) Point

NewPoint creates a point

func (*Point) Randomize

func (p *Point) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Point) Scan

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

Scan from query

func (Point) Value

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

Value representation for database

type Polygon

type Polygon []Point

Polygon is represented by lists of points (the vertexes of the polygon).

func NewPolygon

func NewPolygon(P []Point) Polygon

NewPolygon creates a polygon

func (*Polygon) Randomize

func (p *Polygon) Randomize(nextInt func() int64, fieldType string, shouldBeNull bool)

Randomize for sqlboiler

func (*Polygon) Scan

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

Scan from sql query

func (Polygon) Value

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

Value for database

Jump to

Keyboard shortcuts

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