pac

package
v0.0.0-...-10cd7db Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("cache: item not found")

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(client redis.Conn) *Cache

func (*Cache) GetResponse

func (s *Cache) GetResponse(k string) (*Response, error)

func (*Cache) SetResponse

func (s *Cache) SetResponse(k string, r *Response) error

type Case

type Case struct {
	Da string `json:"da" valid:"-"`
	Tv string `json:"tv" valid:"-"`
	Vi string `json:"vi" valid:"-"`
	Pr string `json:"pr" valid:"-"`
	Ro string `json:"ro" valid:"-"`
}

func (*Case) DecodeMsgpack

func (c *Case) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Case) EncodeMsgpack

func (c *Case) EncodeMsgpack(enc *msgpack.Encoder) error

type Coordinate

type Coordinate struct {
	Lon float64 `json:"lon" valid:"-"`
	Lat float64 `json:"lat" valid:"-"`
}

func (*Coordinate) DecodeMsgpack

func (c *Coordinate) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Coordinate) EncodeMsgpack

func (c *Coordinate) EncodeMsgpack(enc *msgpack.Encoder) error

type Request

type Request struct {
	URI string
}

type RespEntity

type RespEntity struct {
	Code            string      `json:"code" valid:"-"`
	MainAirportName string      `json:"main_airport_name" valid:"-"`
	CountryCases    string      `json:"country_cases" valid:"-"`
	IndexStrings    []string    `json:"index_strings" valid:"-"`
	Weight          int         `json:"weight" valid:"-"`
	Cases           *Case       `json:"cases" valid:"-"`
	CountryName     string      `json:"country_name" valid:"-"`
	Type            string      `json:"type" valid:"-"`
	Coordinates     *Coordinate `json:"coordinates" valid:"-"`
	Name            string      `json:"name" valid:"-"`
	StateCode       string      `json:"state_code" valid:"-"`
	CityName        string      `json:"city_name" valid:"-"`
}

func (*RespEntity) DecodeMsgpack

func (re *RespEntity) DecodeMsgpack(dec *msgpack.Decoder) error

func (*RespEntity) EncodeMsgpack

func (re *RespEntity) EncodeMsgpack(enc *msgpack.Encoder) error

type Response

type Response struct {
	Collection []*RespEntity
}

func (*Response) DecodeMsgpack

func (r *Response) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Response) EncodeMsgpack

func (r *Response) EncodeMsgpack(enc *msgpack.Encoder) error

type Service

type Service struct {
	RemoteAPIPath string
	// contains filtered or unexported fields
}

Service implements main logic with interaction the remote API

func NewService

func NewService(log zerolog.Logger, APIPath string, cachesvc *Cache) *Service

func (*Service) Do

func (s *Service) Do(ctx context.Context, req *Request) (*Response, error)

Jump to

Keyboard shortcuts

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