entity

package
v0.0.0-...-09f4171 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type City

type City struct {
	City struct {
		GeoNameID uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		Names     map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"city" json:"city,omitempty"`
	Continent struct {
		Code      string            `maxminddb:"code" json:"code,omitempty"`
		GeoNameID uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		Names     map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"continent" json:"continent,omitempty"`
	Country struct {
		GeoNameID         uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"isInEuropeanUnion,omitempty"`
		IsoCode           string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names             map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"country" json:"country,omitempty"`
	Location struct {
		AccuracyRadius uint16  `maxminddb:"accuracy_radius" json:"accuracyRadius,omitempty"`
		Latitude       float64 `maxminddb:"latitude" json:"latitude,omitempty"`
		Longitude      float64 `maxminddb:"longitude" json:"longitude,omitempty"`
		MetroCode      uint    `maxminddb:"metro_code" json:"metroCode,omitempty"`
		TimeZone       string  `maxminddb:"time_zone" json:"timeZone,omitempty"`
	} `maxminddb:"location" json:"location,omitempty"`
	Postal struct {
		Code string `maxminddb:"code" json:"code,omitempty"`
	} `maxminddb:"postal" json:"postal,omitempty"`
	RegisteredCountry struct {
		GeoNameID         uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"isInEuropeanUnion,omitempty"`
		IsoCode           string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names             map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"registered_country" json:"registeredCountry,omitempty"`
	RepresentedCountry struct {
		GeoNameID         uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"isInEuropeanUnion,omitempty"`
		IsoCode           string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names             map[string]string `maxminddb:"names" json:"names,omitempty"`
		Type              string            `maxminddb:"type" json:"type,omitempty"`
	} `maxminddb:"represented_country" json:"representedCountry,omitempty"`
	Subdivisions []struct {
		GeoNameID uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsoCode   string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names     map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"subdivisions" json:"subdivisions,omitempty"`
	Traits struct {
		IsAnonymousProxy    bool `maxminddb:"is_anonymous_proxy" json:"isAnonymousProxy,omitempty"`
		IsSatelliteProvider bool `maxminddb:"is_satellite_provider" json:"isSatelliteProvider,omitempty"`
	} `maxminddb:"traits" json:"traits,omitempty"`

	ISP *ISP `json:"ISP,omitempty"`
}
var PrivateCity City

func (City) MarshalCSV

func (record City) MarshalCSV() (names, row []string, err error)

func (City) ToMMDBType

func (city City) ToMMDBType() mmdbtype.Map

type CityLite

type CityLite struct {
	City struct {
		Name string `json:"name,omitempty"`
	} `json:"city,omitempty"`
	Country struct {
		ISOCode string `json:"isoCode,omitempty"`
		Name    string `json:"name,omitempty"`
	} `json:"country,omitempty"`
	Location LocationLite `json:"location,omitempty"`
}

func DbToCityLite

func DbToCityLite(cityLiteDb *CityLiteDb, lang string) *CityLite

type CityLiteDb

type CityLiteDb struct {
	City struct {
		Names map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"city" json:"city,omitempty"`
	Country struct {
		ISOCode string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names   map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"country" json:"country,omitempty"`
	Location LocationLite `maxminddb:"location" json:"location,omitempty"`
}

type Comparable

type Comparable[V any] = source.Comparable[V]

type Country

type Country struct {
	Continent struct {
		Code      string            `maxminddb:"code" json:"code,omitempty"`
		GeoNameID uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		Names     map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"continent" json:"continent,omitempty"`
	Country struct {
		GeoNameID         uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"isInEuropeanUnion,omitempty"`
		IsoCode           string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names             map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"country" json:"country,omitempty"`
	RegisteredCountry struct {
		GeoNameID         uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"isInEuropeanUnion,omitempty"`
		IsoCode           string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names             map[string]string `maxminddb:"names" json:"names,omitempty"`
	} `maxminddb:"registered_country" json:"registeredCountry,omitempty"`
	RepresentedCountry struct {
		GeoNameID         uint              `maxminddb:"geoname_id" json:"geoNameID,omitempty"`
		IsInEuropeanUnion bool              `maxminddb:"is_in_european_union" json:"isInEuropeanUnion,omitempty"`
		IsoCode           string            `maxminddb:"iso_code" json:"isoCode,omitempty"`
		Names             map[string]string `maxminddb:"names" json:"names,omitempty"`
		Type              string            `maxminddb:"type" json:"type,omitempty"`
	} `maxminddb:"represented_country" json:"representedCountry,omitempty"`
	Traits struct {
		IsAnonymousProxy    bool `maxminddb:"is_anonymous_proxy" json:"isAnonymousProxy,omitempty"`
		IsSatelliteProvider bool `maxminddb:"is_satellite_provider" json:"isSatelliteProvider,omitempty"`
	} `maxminddb:"traits" json:"traits,omitempty"`
}

type DBUpdate

type DBUpdate[V Version[V]] struct {
	CurrentVersion   V       `json:"currentVersion"`
	AvailableVersion *V      `json:"availableVersion,omitempty"`
	UpdateError      *string `json:"updateError,omitempty"`
	InProgress       bool    `json:"inProgress,omitempty"`
}

func NewDBUpdate

func NewDBUpdate[V Version[V]](update Update[V], inProgress bool, lastUpdateError *string) DBUpdate[V]

type Database

type Database struct {
	Data io.Reader
	MetaData
	Ext string
}

func (*Database) FileName

func (db *Database) FileName() string

type GeoName

type GeoName struct {
	*models.Geoname
	ContinentCode   string `csv:"continent code"`
	ContinentName   string `csv:"continent name"`
	CountryName     string `csv:"country name"`
	SubdivisionName string `csv:"subdivision name"`
}

func (GeoName) GetCityName

func (g GeoName) GetCityName() string

func (GeoName) GetContinentCode

func (g GeoName) GetContinentCode() string

func (GeoName) GetContinentName

func (g GeoName) GetContinentName() string

func (GeoName) GetCountryCode

func (g GeoName) GetCountryCode() string

func (GeoName) GetCountryName

func (g GeoName) GetCountryName() string

func (GeoName) GetGeoNameID

func (g GeoName) GetGeoNameID() int

func (GeoName) GetName

func (g GeoName) GetName() string

func (GeoName) GetSubdivisionName

func (g GeoName) GetSubdivisionName() string

func (GeoName) GetTimeZone

func (g GeoName) GetTimeZone() string

func (GeoName) MarshalJSON

func (s GeoName) MarshalJSON() ([]byte, error)

func (*GeoName) UnmarshalJSON

func (s *GeoName) UnmarshalJSON(data []byte) error

type GeoNameAdminSubdivision

type GeoNameAdminSubdivision struct {
	*models.AdminDivision
	ContinentCode string `csv:"continent code"`
	ContinentName string `csv:"continent name"`
	CountryName   string `csv:"country name"`
}

func (GeoNameAdminSubdivision) AdminCode

func (s GeoNameAdminSubdivision) AdminCode() string

func (GeoNameAdminSubdivision) GetCityName

func (s GeoNameAdminSubdivision) GetCityName() string

func (GeoNameAdminSubdivision) GetContinentCode

func (s GeoNameAdminSubdivision) GetContinentCode() string

func (GeoNameAdminSubdivision) GetContinentName

func (s GeoNameAdminSubdivision) GetContinentName() string

func (GeoNameAdminSubdivision) GetCountryCode

func (s GeoNameAdminSubdivision) GetCountryCode() string

func (GeoNameAdminSubdivision) GetCountryName

func (s GeoNameAdminSubdivision) GetCountryName() string

func (GeoNameAdminSubdivision) GetGeoNameID

func (s GeoNameAdminSubdivision) GetGeoNameID() int

func (GeoNameAdminSubdivision) GetName

func (s GeoNameAdminSubdivision) GetName() string

func (GeoNameAdminSubdivision) GetSubdivisionName

func (s GeoNameAdminSubdivision) GetSubdivisionName() string

func (GeoNameAdminSubdivision) GetTimeZone

func (s GeoNameAdminSubdivision) GetTimeZone() string

func (GeoNameAdminSubdivision) MarshalJSON

func (s GeoNameAdminSubdivision) MarshalJSON() ([]byte, error)

func (*GeoNameAdminSubdivision) UnmarshalJSON

func (s *GeoNameAdminSubdivision) UnmarshalJSON(data []byte) error

type GeoNameContinent

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

func NewGeoNameContinent

func NewGeoNameContinent(geonameID int, code, name string) *GeoNameContinent

func (GeoNameContinent) Code

func (c GeoNameContinent) Code() string

func (GeoNameContinent) GetCityName

func (c GeoNameContinent) GetCityName() string

func (GeoNameContinent) GetContinentCode

func (c GeoNameContinent) GetContinentCode() string

func (GeoNameContinent) GetContinentName

func (c GeoNameContinent) GetContinentName() string

func (GeoNameContinent) GetCountryCode

func (c GeoNameContinent) GetCountryCode() string

func (GeoNameContinent) GetCountryName

func (c GeoNameContinent) GetCountryName() string

func (GeoNameContinent) GetGeoNameID

func (c GeoNameContinent) GetGeoNameID() int

func (GeoNameContinent) GetName

func (c GeoNameContinent) GetName() string

func (GeoNameContinent) GetSubdivisionName

func (c GeoNameContinent) GetSubdivisionName() string

func (GeoNameContinent) GetTimeZone

func (c GeoNameContinent) GetTimeZone() string

func (GeoNameContinent) MarshalJSON

func (s GeoNameContinent) MarshalJSON() ([]byte, error)

func (*GeoNameContinent) UnmarshalJSON

func (s *GeoNameContinent) UnmarshalJSON(data []byte) error

type GeoNameCountry

type GeoNameCountry struct {
	*models.Country
	ContinentName string `csv:"continent name"`
}

func (GeoNameCountry) GetCityName

func (s GeoNameCountry) GetCityName() string

func (GeoNameCountry) GetContinentCode

func (s GeoNameCountry) GetContinentCode() string

func (GeoNameCountry) GetContinentName

func (s GeoNameCountry) GetContinentName() string

func (GeoNameCountry) GetCountryCode

func (s GeoNameCountry) GetCountryCode() string

func (GeoNameCountry) GetCountryName

func (s GeoNameCountry) GetCountryName() string

func (GeoNameCountry) GetGeoNameID

func (s GeoNameCountry) GetGeoNameID() int

func (GeoNameCountry) GetName

func (s GeoNameCountry) GetName() string

func (GeoNameCountry) GetSubdivisionName

func (s GeoNameCountry) GetSubdivisionName() string

func (GeoNameCountry) GetTimeZone

func (s GeoNameCountry) GetTimeZone() string

func (GeoNameCountry) MarshalJSON

func (s GeoNameCountry) MarshalJSON() ([]byte, error)

func (*GeoNameCountry) UnmarshalJSON

func (s *GeoNameCountry) UnmarshalJSON(data []byte) error

type GeoNameEntity

type GeoNameEntity interface {
	GetGeoNameID() int
	GetName() string //own name
	GetContinentCode() string
	GetContinentName() string
	GetCountryCode() string
	GetCountryName() string
	GetSubdivisionName() string
	GetCityName() string
	GetTimeZone() string
}

type GeoNameFilter

type GeoNameFilter struct {
	GeoNameIDs   []uint32 `schema:"geoname-ids" json:"geonameIds"`
	CountryCodes []string `schema:"country-codes" json:"countryCodes"`
	NamePrefix   string   `schema:"name-prefix" json:"namePrefix"`
	Limit        uint32   `schema:"limit" json:"limit"`
}

func (*GeoNameFilter) Match

func (f *GeoNameFilter) Match(e GeoNameEntity) bool

type GeoNamesVersion

type GeoNamesVersion = ModTimeVersion

type ISP

type ISP struct {
	AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"`
	ISP                          string `maxminddb:"isp"`
	MobileCountryCode            string `maxminddb:"mobile_country_code"`
	MobileNetworkCode            string `maxminddb:"mobile_network_code"`
	Organization                 string `maxminddb:"organization"`
	AutonomousSystemNumber       uint   `maxminddb:"autonomous_system_number"`
}

The ISP struct corresponds to the data in the GeoIP2 ISP database.

func (ISP) MarshalCSV

func (record ISP) MarshalCSV() (names, row []string, err error)

type LocationLite

type LocationLite struct {
	Latitude  float64 `maxminddb:"latitude" json:"latitude,omitempty"`
	Longitude float64 `maxminddb:"longitude" json:"longitude,omitempty"`
	TimeZone  string  `maxminddb:"time_zone" json:"timeZone,omitempty"`
}

type MMDBVersion

type MMDBVersion source.MMDBVersion

func (MMDBVersion) Compare

func (v MMDBVersion) Compare(other MMDBVersion) int

func (MMDBVersion) MarshalJSON

func (v MMDBVersion) MarshalJSON() ([]byte, error)

func (*MMDBVersion) UnmarshalJSON

func (v *MMDBVersion) UnmarshalJSON(data []byte) error

type MetaData

type MetaData = maxminddb.Metadata

type ModTimeVersion

type ModTimeVersion time.Time

func (ModTimeVersion) Compare

func (v ModTimeVersion) Compare(other ModTimeVersion) int

func (ModTimeVersion) MarshalJSON

func (v ModTimeVersion) MarshalJSON() ([]byte, error)

func (*ModTimeVersion) UnmarshalJSON

func (v *ModTimeVersion) UnmarshalJSON(data []byte) error

type PatchVersion

type PatchVersion = ModTimeVersion

type PatchedGeoNamesVersion

type PatchedGeoNamesVersion struct {
	DB    GeoNamesVersion `json:"db,omitempty"`
	Patch *ModTimeVersion `json:"patch,omitempty"`
}

func (PatchedGeoNamesVersion) Compare

func (PatchedGeoNamesVersion) String

func (v PatchedGeoNamesVersion) String() string

type PatchedMMDBVersion

type PatchedMMDBVersion struct {
	DB    MMDBVersion     `json:"db,omitempty"`
	Patch *ModTimeVersion `json:"patch,omitempty"`
}

func (PatchedMMDBVersion) Compare

func (v PatchedMMDBVersion) Compare(other PatchedMMDBVersion) int

func (PatchedMMDBVersion) String

func (v PatchedMMDBVersion) String() string

type Update

type Update[V source.Comparable[V]] = source.Update[V]

type Version

type Version[V any] interface {
	source.Comparable[V]
	fmt.Stringer
}

Jump to

Keyboard shortcuts

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