latlon

package
v0.0.310 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LatKey = "lat"
	LonKey = "lon"
)

Variables

View Source
var (
	LatKeyFn = contract.PathKeyFn(LatKey)
	LonKeyFn = contract.PathKeyFn(LonKey)
)

Functions

func Idx

func Idx(p ...string) []contract.IndexEntry

func IdxSrch

func IdxSrch(p ...string) []contract.SearchIndexEntry

func Rules

Types

type Core

type Core struct {
	Lat *float64 `json:"lat" validate:"nnpt"`
	Lon *float64 `json:"lon" validate:"nnpt"`
}

func ApplyCore

func ApplyCore(c *Core, modifiers ...CoreOption) Core

func (*Core) GetLat

func (c *Core) GetLat() float64

func (*Core) GetLon

func (c *Core) GetLon() float64

func (*Core) SetLat

func (c *Core) SetLat(x float64)

func (*Core) SetLon

func (c *Core) SetLon(x float64)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithLat

func WithLat(x float64) CoreOption

func WithLatLon

func WithLatLon(x float64, y float64) CoreOption

func WithLon

func WithLon(x float64) CoreOption

type LatLon

type LatLon struct {
	Meta `bson:",inline" validate:"recurse"`
	Core `bson:",inline" validate:"recurse"`
}

LatLon represents a latitude and longitude.

func Mock

func Mock(x float64, y float64) *LatLon

func MockMontreal

func MockMontreal() *LatLon

func MockNashville

func MockNashville() *LatLon

func MockNewYork

func MockNewYork() *LatLon

func New

func New(m Meta, cr Core) *LatLon

func Zero added in v0.0.183

func Zero() *LatLon

type Meta

type Meta struct{}

func ApplyMeta

func ApplyMeta(m *Meta, modifiers ...MetaOption) Meta

type MetaOption

type MetaOption = contract.MetaOption[Meta]

Jump to

Keyboard shortcuts

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