utils

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatCityName

func FormatCityName(city string) string

func FormatCountryCN

func FormatCountryCN(countryCNOrCode string) string

func FormatProvinceName

func FormatProvinceName(province string) string

func GetCountryCodeMap

func GetCountryCodeMap() map[string]string

func GetCountryMap

func GetCountryMap() map[string]Country

func LookupGeoInfo

func LookupGeoInfo(geo *geoip.GeoInfo) bool

func NewGeoFromLocation

func NewGeoFromLocation(countryCNOrCode, province, city string) *geoip.GeoInfo

Types

type City

type City struct {
	Location
	Code string `json:"code"`
}

type Country

type Country struct {
	Location
	CountryEN   string              `json:"country_en,omitempty"`
	CountryCode string              `json:"country_code,omitempty"`
	Provinces   map[string]Province `json:"provinces"`
	Cities      map[string]City     `json:"cities"`
}

type Location

type Location struct {
	Coords   []float64 `json:"coords"`
	Timezone string    `json:"timezone,omitempty"`
}

type Province

type Province struct {
	Location
	Code   string   `json:"code,omitempty"`
	Cities []string `json:"cities"`
}

Jump to

Keyboard shortcuts

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