Documentation ¶
Index ¶
- Constants
- func CloseDatabases()
- type City
- type Configuration
- type Continent
- type Country
- type Database
- type GeoData
- type JsonResponse
- type Location
- type NullWriter
- type Pathname
- func (f *Pathname) Basename() *Pathname
- func (f *Pathname) Dirname() *Pathname
- func (f *Pathname) Exists() bool
- func (f *Pathname) Join(paths ...interface{}) *Pathname
- func (f *Pathname) Path() string
- func (f *Pathname) Read() ([]byte, error)
- func (f *Pathname) RealPath() (*Pathname, error)
- func (f *Pathname) Set(value string) error
- func (f *Pathname) String() string
- type Postal
- type RepresentedCountry
- type Subdivision
- type Traits
Constants ¶
const Separator = string(os.PathSeparator)
Variables ¶
This section is empty.
Functions ¶
func CloseDatabases ¶
func CloseDatabases()
Types ¶
type City ¶
type City struct {
Name string `json:"name,omitempty"`
}
func (*City) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*City) MarshalJSONBuf ¶
func (j *City) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type Configuration ¶
type Configuration struct { Ip string `json:"server.ip"` Port uint32 `json:"server.port"` DbPath *Pathname `json:"database.file"` Threads uint8 `json:"worker.threads"` CacheTtl float64 `json:"cache.ttl"` }
ffjson: noencoder
func NewConfiguration ¶
func NewConfiguration() *Configuration
create a new configuration with default values
func (*Configuration) LoadFromJson ¶
func (c *Configuration) LoadFromJson(data []byte) error
func (*Configuration) LoadFromJsonFile ¶
func (c *Configuration) LoadFromJsonFile(configFile *Pathname) error
func (*Configuration) UnmarshalJSON ¶
func (j *Configuration) UnmarshalJSON(input []byte) error
UnmarshalJSON umarshall json - template of ffjson
func (*Configuration) UnmarshalJSONFFLexer ¶
func (j *Configuration) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Continent ¶
func (*Continent) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Continent) MarshalJSONBuf ¶
func (j *Continent) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type Country ¶
type Country struct { IsInEuropeanUnion bool `json:"is_in_european_union,omitempty"` IsoCode string `json:"iso_code,omitempty"` Name string `json:"name,omitempty"` }
func (*Country) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Country) MarshalJSONBuf ¶
func (j *Country) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type GeoData ¶
type GeoData struct { City `json:"city,omitempty"` Continent `json:"continent,omitempty"` Country `json:"country,omitempty"` Location `json:"location,omitempty"` Postal `json:"postal,omitempty"` RegisteredCountry Country `json:"registered_country,omitempty"` RepresentedCountry `json:"represented_country,omitempty"` Subdivisions []Subdivision `json:"subdivisions,omitempty"` Subdivision Subdivision `json:"subdivision,omitempty"` Traits `json:"traits,omitempty"` }
func NewFromGeoIp2City ¶
func (*GeoData) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*GeoData) MarshalJSONBuf ¶
func (j *GeoData) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type JsonResponse ¶
type JsonResponse struct { Status string `json:"status"` Message string `json:"message"` Data *GeoData `json:"data"` }
func (*JsonResponse) MarshalJSON ¶
func (j *JsonResponse) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*JsonResponse) MarshalJSONBuf ¶
func (j *JsonResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type Location ¶
type Location struct { AccuracyRadius uint16 `json:"accuracy_radius,omitempty"` Latitude float64 `json:"latitude,omitempty"` Longitude float64 `json:"longitude,omitempty"` MetroCode uint `json:"metro_code,omitempty"` TimeZone string `json:"time_zone,omitempty"` }
func (*Location) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Location) MarshalJSONBuf ¶
func (j *Location) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type Pathname ¶
type Pathname struct {
// contains filtered or unexported fields
}
ffjson: skip
func NewPathname ¶
type Postal ¶
type Postal struct {
Code string `json:"code,omitempty"`
}
func (*Postal) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Postal) MarshalJSONBuf ¶
func (j *Postal) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type RepresentedCountry ¶
type RepresentedCountry struct { IsInEuropeanUnion bool `json:"is_in_european_union,omitempty"` IsoCode string `json:"iso_code,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` }
func (*RepresentedCountry) MarshalJSON ¶
func (j *RepresentedCountry) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*RepresentedCountry) MarshalJSONBuf ¶
func (j *RepresentedCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type Subdivision ¶
type Subdivision struct { IsoCode string `json:"iso_code,omitempty"` Name string `json:"name,omitempty"` }
func (*Subdivision) MarshalJSON ¶
func (j *Subdivision) MarshalJSON() ([]byte, error)
MarshalJSON marshal bytes to json - template
func (*Subdivision) MarshalJSONBuf ¶
func (j *Subdivision) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
type Traits ¶
type Traits struct { IsAnonymousProxy bool `json:"is_anonymous_proxy,omitempty"` IsSatelliteProvider bool `json:"is_satellite_provider,omitempty"` }
func (*Traits) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Traits) MarshalJSONBuf ¶
func (j *Traits) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template