mm

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
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

func (j *City) MarshalJSON() ([]byte, error)

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

type Continent struct {
	Code string `json:"code,omitempty"`
	Name string `json:"name,omitempty"`
}

func (*Continent) MarshalJSON

func (j *Continent) MarshalJSON() ([]byte, error)

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

func (j *Country) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Country) MarshalJSONBuf

func (j *Country) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

type Database

type Database struct {
	Reader *geoip2.Reader
}

ffjson: skip

func GetDatabase

func GetDatabase(path string) (*Database, error)

func (*Database) Close

func (db *Database) Close()

func (*Database) Lookup

func (db *Database) Lookup(ipText string) (*GeoData, error)

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 NewFromGeoIp2City(record *geoip2.City) *GeoData

func (*GeoData) MarshalJSON

func (j *GeoData) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*GeoData) MarshalJSONBuf

func (j *GeoData) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*GeoData) Unknown

func (gd *GeoData) Unknown() bool

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

func (j *Location) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Location) MarshalJSONBuf

func (j *Location) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

type NullWriter

type NullWriter struct{}

ffjson: skip

func (*NullWriter) Write

func (nw *NullWriter) Write(data []byte) (int, error)

type Pathname

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

ffjson: skip

func NewPathname

func NewPathname(path string) *Pathname

func (*Pathname) Basename

func (f *Pathname) Basename() *Pathname

func (*Pathname) Dirname

func (f *Pathname) Dirname() *Pathname

func (*Pathname) Exists

func (f *Pathname) Exists() bool

func (*Pathname) Join

func (f *Pathname) Join(paths ...interface{}) *Pathname

func (*Pathname) Path

func (f *Pathname) Path() string

func (*Pathname) Read

func (f *Pathname) Read() ([]byte, error)

func (*Pathname) RealPath

func (f *Pathname) RealPath() (*Pathname, error)

func (*Pathname) Set

func (f *Pathname) Set(value string) error

func (*Pathname) String

func (f *Pathname) String() string

type Postal

type Postal struct {
	Code string `json:"code,omitempty"`
}

func (*Postal) MarshalJSON

func (j *Postal) MarshalJSON() ([]byte, error)

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

func (j *Traits) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Traits) MarshalJSONBuf

func (j *Traits) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

Jump to

Keyboard shortcuts

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