Documentation ¶
Index ¶
- func NewPool(configPath string) (*redis.Pool, error)
- type Coordinate
- type Geo
- func (s *Geo) Add(key string, data []*Member) error
- func (s *Geo) Dist(key, a, b string, u Unit) (float64, error)
- func (s *Geo) Hash(key string, list ...string) ([]string, error)
- func (s *Geo) Pos(key string, names ...string) ([]*Member, error)
- func (s *Geo) Radius(key string, coord Coordinate, radius int, unit string, options ...Option) ([]*Neighbor, error)
- func (s *Geo) RadiusByName(key string, name string, radius int, unit string, options ...Option) ([]*Neighbor, error)
- type Member
- type Neighbor
- type Option
- type PoolConfig
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Coordinate ¶
Coordinate present geo location
type Geo ¶
type Geo struct {
// contains filtered or unexported fields
}
Geo is the core service for geolocation-related operation
func (*Geo) Pos ¶
Pos gets the meta data by key returned meta data hase the same order of names leave nil for the keys have no data
type Member ¶
type Member struct { Name string `json:"name"` Coord Coordinate `json:"coord"` }
Member present the Coordinate and the key of data
type PoolConfig ¶
type PoolConfig struct { IdleConn int `json:"idle_conn"` ActiveConn int `json:"active_conn"` Protocol string `json:"protocol"` Addr string `json:"addr"` DB int `json:"db"` TobTimeout string `json:"tob_timeout"` IdleTimeout string `json:"idle_timeout"` ConnTimeout string `json:"conn_timeout"` ReadTimeout string `json:"read_timeout"` WriteTimeout string `json:"write_timeout"` }
PoolConfig is the struct for config pool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.