types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package types provides shared, specialized data types for use with MongoDB documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	// Type specifies the GeoJSON object type, which is "Point" for a single coordinate.
	Type string `bson:"type"`
	// Coordinates holds the geographic coordinates in the format [longitude, latitude].
	Coordinates []float64 `bson:"coordinates"`
}

Location represents a GeoJSON Point, a standard format for encoding geographic coordinates. This struct is compatible with MongoDB's geospatial queries. See MongoDB documentation for more details: https://www.mongodb.com/docs/manual/reference/geojson/

func NewLocationPoint

func NewLocationPoint(longitude, latitude float64) *Location

NewLocationPoint is a constructor function that creates a new Location object. It ensures the correct structure and type for a GeoJSON point.

longitude: The longitude, ranging from -180 to 180. latitude: The latitude, ranging from -90 to 90. Returns a pointer to the newly created Location.

Jump to

Keyboard shortcuts

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