Documentation ¶
Overview ¶
Package pq_types provides additional types for PostgreSQL: int, bigint and string arrays (former is compatible with intarray module), json and jsonb values, few PostGIS types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NullInt32 ¶ added in v1.1.0
NullInt32 covers trivial case of int32 to sql.NullInt32 conversion assuming 0 to be NULL
func NullInt64 ¶ added in v1.1.0
NullInt64 covers trivial case of int64 to sql.NullInt64 conversion assuming 0 to be NULL
func NullString ¶ added in v1.1.0
func NullString(src string) sql.NullString
NullString covers trivial case of string to sql.NullString conversion assuming empty string to be NULL
Types ¶
type Int32Array ¶
type Int32Array []int32
Int32Array is a slice of int32 values, compatible with PostgreSQL's int[] and intarray module.
func (Int32Array) EqualWithoutOrder ¶
func (a Int32Array) EqualWithoutOrder(b Int32Array) bool
EqualWithoutOrder returns true if two int32 arrays are equal without order, false otherwise. It may sort both arrays in-place to do so.
func (Int32Array) Len ¶
func (a Int32Array) Len() int
func (Int32Array) Less ¶
func (a Int32Array) Less(i, j int) bool
func (*Int32Array) Scan ¶
func (a *Int32Array) Scan(value interface{}) error
Scan implements database/sql Scanner interface.
func (Int32Array) Swap ¶
func (a Int32Array) Swap(i, j int)
type Int64Array ¶
type Int64Array []int64
Int64Array is a slice of int64 values, compatible with PostgreSQL's bigint[].
func (Int64Array) EqualWithoutOrder ¶
func (a Int64Array) EqualWithoutOrder(b Int64Array) bool
EqualWithoutOrder returns true if two int64 arrays are equal without order, false otherwise. It may sort both arrays in-place to do so.
func (Int64Array) Len ¶
func (a Int64Array) Len() int
func (Int64Array) Less ¶
func (a Int64Array) Less(i, j int) bool
func (*Int64Array) Scan ¶
func (a *Int64Array) Scan(value interface{}) error
Scan implements database/sql Scanner interface.
func (Int64Array) Swap ¶
func (a Int64Array) Swap(i, j int)
type JSONText ¶
type JSONText []byte
JSONText is a raw encoded JSON value, compatible with PostgreSQL's varchar, text, json and jsonb. It behaves like json.RawMessage by implementing json.Marshaler and json.Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
func (JSONText) MarshalJSON ¶
MarshalJSON returns j as the JSON encoding of j.
func (*JSONText) Scan ¶
Scan implements database/sql Scanner interface. It store value in *j. No validation is done.
func (*JSONText) UnmarshalJSON ¶
UnmarshalJSON sets *j to a copy of data.
type PostGISBox2D ¶
type PostGISBox2D struct {
Min, Max PostGISPoint
}
PostGISBox2D is wrapper for PostGIS Box2D type.
func (*PostGISBox2D) Scan ¶
func (b *PostGISBox2D) Scan(value interface{}) error
Scan implements database/sql Scanner interface. It expectes WKT.
type PostGISPoint ¶
type PostGISPoint struct {
Lon, Lat float64
}
PostGISPoint is wrapper for PostGIS POINT type.
func (*PostGISPoint) Scan ¶
func (p *PostGISPoint) Scan(value interface{}) error
Scan implements database/sql Scanner interface. It expectes EWKB with SRID 4326 (WGS 84).
type PostGISPolygon ¶
type PostGISPolygon struct {
Points []PostGISPoint
}
PostGISPolygon is wrapper for PostGIS Polygon type.
func MakeEnvelope ¶
func MakeEnvelope(min, max PostGISPoint) PostGISPolygon
MakeEnvelope returns rectangular (min, max) polygon
func (*PostGISPolygon) Max ¶
func (p *PostGISPolygon) Max() PostGISPoint
Max returns max side of rectangular polygon
func (*PostGISPolygon) Min ¶
func (p *PostGISPolygon) Min() PostGISPoint
Min returns min side of rectangular polygon
func (*PostGISPolygon) Scan ¶
func (p *PostGISPolygon) Scan(value interface{}) error
Scan implements database/sql Scanner interface. It expectes EWKB with SRID 4326 (WGS 84).
type StringArray ¶
type StringArray []string
StringArray is a slice of string values, compatible with PostgreSQL's varchar[].
func (StringArray) Len ¶
func (a StringArray) Len() int
func (StringArray) Less ¶
func (a StringArray) Less(i, j int) bool
func (*StringArray) Scan ¶
func (a *StringArray) Scan(value interface{}) error
Scan implements database/sql Scanner interface.
func (StringArray) Swap ¶
func (a StringArray) Swap(i, j int)