geo

package
v0.1.304 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGoogleMapsClient

func NewGoogleMapsClient(retryOpts helper.RetryOptions, opts MapsClientOptions) (*maps.Client, error)

Types

type Client

type Client interface {
	contract.Geocoder
}

func NewClient

func NewClient(d Dependencies) (Client, error)

type DefaultTool added in v0.1.11

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) CityFromCoordinates added in v0.1.11

func (d *DefaultTool) CityFromCoordinates(ctx context.Context, latitude, longitude float64) (string, error)

CityFromCoordinates retrieves the city name for given coordinates.

func (*DefaultTool) GeocodeCoordinates added in v0.1.11

func (d *DefaultTool) GeocodeCoordinates(ctx context.Context, latitude, longitude float64) ([]maps.GeocodingResult, error)

GeocodeCoordinates retrieves geolocation data for given coordinates.

func (*DefaultTool) IsUTC added in v0.1.11

func (d *DefaultTool) IsUTC(ctx context.Context, t time.Time) (bool, error)

IsUTC checks whether a given time value is in UTC.

func (*DefaultTool) SwapTimezone added in v0.1.11

func (d *DefaultTool) SwapTimezone(ctx context.Context, t time.Time, tz string, toUTC, toMidnight bool) (time.Time, error)

SwapTimezone converts a time value to a specific timezone.

func (*DefaultTool) TimezoneDataFromCoordinates added in v0.1.11

func (d *DefaultTool) TimezoneDataFromCoordinates(ctx context.Context, latitude, longitude float64) (*maps.TimezoneResult, error)

TimezoneDataFromCoordinates retrieves full timezone data for given coordinates.

func (*DefaultTool) TimezoneFromCoordinates added in v0.1.11

func (d *DefaultTool) TimezoneFromCoordinates(ctx context.Context, latitude, longitude float64) (string, error)

TimezoneFromCoordinates retrieves the timezone ID for given coordinates.

type Dependencies added in v0.1.8

type Dependencies struct {
	C contract.GoogleMaps
}

type Loaded added in v0.1.122

type Loaded struct {
	APIKey string
}

type MapsClientOptions

type MapsClientOptions struct {
	Loaded
	LimitPerSecond int
}

MapsClientOptions contains the options for the google maps client. A limit per second of 0 disable the rate limit.

func DefaultMapsClientOptions

func DefaultMapsClientOptions(APIKey string) MapsClientOptions

DefaultMapsClientOptions returns the default options for the google maps client.

type Tool added in v0.1.245

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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