value

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeUnknown = Type("")

Functions

This section is empty.

Types

type Coordinates

type Coordinates []LatLngHeight

func CoordinatesFrom

func CoordinatesFrom(coords []float64) Coordinates

CoordinatesFrom generates a new Coordinates from slice such as [lon, lat, alt, lon, lat, alt, ...]

type LatLng

type LatLng struct {
	Lat float64 `json:"lat" mapstructure:"lat"`
	Lng float64 `json:"lng" mapstructure:"lng"`
}

func (*LatLng) Clone

func (l *LatLng) Clone() *LatLng

type LatLngHeight

type LatLngHeight struct {
	Lat    float64 `json:"lat" mapstructure:"lat"`
	Lng    float64 `json:"lng" mapstructure:"lng"`
	Height float64 `json:"height" mapstructure:"height"`
}

func (*LatLngHeight) Clone

func (l *LatLngHeight) Clone() *LatLngHeight

type Optional

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

func NewOptional

func NewOptional(t Type, v *Value) *Optional

func OptionalFrom

func OptionalFrom(v *Value) *Optional

func (*Optional) Cast

func (ov *Optional) Cast(t Type, p TypePropertyMap) *Optional

Cast tries to convert the value to the new type and generates a new Optional.

func (*Optional) Clone

func (ov *Optional) Clone() *Optional

func (*Optional) SetValue

func (ov *Optional) SetValue(v *Value)

func (*Optional) Type

func (ov *Optional) Type() Type

func (*Optional) TypeAndValue

func (ov *Optional) TypeAndValue() (Type, *Value)

func (*Optional) Value

func (ov *Optional) Value() *Value

type Polygon

type Polygon []Coordinates

func PolygonFrom

func PolygonFrom(rings [][]float64) Polygon

type Rect

type Rect struct {
	West  float64 `json:"west" mapstructure:"west"`
	South float64 `json:"south" mapstructure:"south"`
	East  float64 `json:"east" mapstructure:"east"`
	North float64 `json:"north" mapstructure:"north"`
}

type Type

type Type string
var TypeBool Type = "bool"
var TypeCoordinates Type = "coordinates"
var TypeLatLng Type = "latlng"
var TypeLatLngHeight Type = "latlngheight"
var TypeNumber Type = "number"
var TypePolygon Type = "polygon"
var TypeRect Type = "rect"
var TypeRef Type = "ref"
var TypeString Type = "string"
var TypeURL Type = "url"

func (Type) Default

func (t Type) Default() bool

func (Type) None added in v0.4.0

func (t Type) None() *Optional

func (Type) ValueFrom

func (t Type) ValueFrom(i interface{}, p TypePropertyMap) *Value

type TypeProperty

type TypeProperty interface {
	I2V(interface{}) (interface{}, bool)
	V2I(interface{}) (interface{}, bool)
	Validate(interface{}) bool
}

type TypePropertyMap

type TypePropertyMap = map[Type]TypeProperty

type Value

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

func (*Value) Cast

func (v *Value) Cast(t Type, p TypePropertyMap) *Value

func (*Value) Clone

func (v *Value) Clone() *Value

func (*Value) Interface

func (v *Value) Interface() interface{}

Interface converts the value into generic representation

func (*Value) IsEmpty

func (v *Value) IsEmpty() bool

func (*Value) MarshalJSON

func (v *Value) MarshalJSON() ([]byte, error)

func (*Value) Some added in v0.4.0

func (v *Value) Some() *Optional

func (*Value) Type

func (v *Value) Type() Type

func (*Value) TypeProperty

func (v *Value) TypeProperty() (tp TypeProperty)

func (*Value) Validate

func (v *Value) Validate() bool

func (*Value) Value

func (v *Value) Value() interface{}

func (*Value) ValueBool

func (v *Value) ValueBool() (vv bool, ok bool)

func (*Value) ValueCoordinates

func (v *Value) ValueCoordinates() (vv Coordinates, ok bool)

func (*Value) ValueLatLng

func (v *Value) ValueLatLng() (vv LatLng, ok bool)

func (*Value) ValueLatLngHeight

func (v *Value) ValueLatLngHeight() (vv LatLngHeight, ok bool)

func (*Value) ValueNumber

func (v *Value) ValueNumber() (vv float64, ok bool)

func (*Value) ValuePolygon

func (v *Value) ValuePolygon() (vv Polygon, ok bool)

func (*Value) ValueRect

func (v *Value) ValueRect() (vv Rect, ok bool)

func (*Value) ValueRef

func (v *Value) ValueRef() (vv string, ok bool)

func (*Value) ValueString

func (v *Value) ValueString() (vv string, ok bool)

func (*Value) ValueURL

func (v *Value) ValueURL() (vv *url.URL, ok bool)

Jump to

Keyboard shortcuts

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