vo

package
v0.0.0-...-5c79d94 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const EarthRadius float64 = 6378.137 * 1000

EarthRadius radius of Earth in meters (6378.137 km converted to meters)

View Source
const PI float64 = 3.141592653589793

PI mathematical constant for calculations

Variables

This section is empty.

Functions

func Generate

func Generate(length int) string

Types

type Coordinate

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

Coordinate represents a geographic coordinate with latitude and longitude using decimal.Decimal for precise numeric representation

func NewCoordinate

func NewCoordinate(latitude decimal.Decimal, longitude decimal.Decimal) *Coordinate

NewCoordinate creates a new Coordinate instance with given latitude and longitude

func NewCoordinateFromFloat64

func NewCoordinateFromFloat64(lat, lng float64) *Coordinate

NewCoordinateFromFloat64 creates a new Coordinate from latitude and longitude float64 values

func NewCoordinateFromGeoHash

func NewCoordinateFromGeoHash(geoHash string) *Coordinate

NewCoordinateFromGeoHash creates a new Coordinate from a geohash string

func NewCoordinateFromString

func NewCoordinateFromString(latitude string, longitude string) (*Coordinate, error)

NewCoordinateFromString creates a new Coordinate from latitude and longitude strings

func (*Coordinate) CalGeoHash

func (c *Coordinate) CalGeoHash() string

CalGeoHash calculates and returns the geohash string for this coordinate

func (*Coordinate) DistanceFrom

func (c *Coordinate) DistanceFrom(vo *Coordinate) float64

DistanceFrom calculates the distance between this coordinate and another coordinate using the Haversine formula, returns distance in meters

func (*Coordinate) Latitude

func (c *Coordinate) Latitude() decimal.Decimal

Latitude returns the latitude of the coordinate

func (*Coordinate) Longitude

func (c *Coordinate) Longitude() decimal.Decimal

Longitude returns the longitude of the coordinate

func (*Coordinate) MarshalJSON

func (c *Coordinate) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Coordinate

func (*Coordinate) UnmarshalJSON

func (c *Coordinate) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Coordinate

type Password

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

func NewPassword

func NewPassword(pwd string) (*Password, error)

func (Password) MarshalText

func (p Password) MarshalText() ([]byte, error)

MarshalText implement TextMarshaler

func (*Password) Scan

func (p *Password) Scan(value interface{}) error

Scan implement Scanner https://gorm.io/docs/data_types.html

func (*Password) Validate

func (p *Password) Validate(pwd string) error

func (*Password) Value

func (p *Password) Value() (driver.Value, error)

Value implement Valuer https://gorm.io/docs/data_types.html

Jump to

Keyboard shortcuts

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