geopos

package
v0.0.0-...-18a316a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware middleware headers for any RESTful requests {{{

func GetCheckPoint

func GetCheckPoint(c *gin.Context)

func GetPointFromToken

func GetPointFromToken(c *gin.Context)

func GetPoints

func GetPoints(c *gin.Context)

GetPoints get all points

func GetRndPoint

func GetRndPoint(c *gin.Context)

func PostCheckPoint

func PostCheckPoint(c *gin.Context)

func PostPoint

func PostPoint(c *gin.Context)

func PostRndPoint

func PostRndPoint(c *gin.Context)

func PutDistance

func PutDistance(c *gin.Context)

func Start

func Start(args []string)

Start will start new server

Types

type Config

type Config struct {
	Port string
	Host string
}

func (*Config) SetDefault

func (config *Config) SetDefault()

type DistanceReq

type DistanceReq struct {
	Distance float64 `form:"Distance" binding:"required"`
}

type GeoPoint

type GeoPoint struct {
	Type        string     `form:"-"`
	Token       string     `form:"Token" binding:"required"`
	Coordinates [2]float64 `form:"Coordinates" binding:"required"`
}

GeoPoint for example {lat: 1.011111, lng: 1.0000450}

func NewGeoPoint

func NewGeoPoint() *GeoPoint

NewGeoPoint will return a new point {{{

func (*GeoPoint) GetDistance

func (point *GeoPoint) GetDistance(toPoint *GeoPoint) (distance float64)

GetDistance set random data to a point// {{{

func (*GeoPoint) SetRnd

func (point *GeoPoint) SetRnd()

SetRnd set random data to a point// {{{

type GeoState

type GeoState struct {
	Location map[string]GeoPoint `json:"Location"`
	sync.RWMutex
}

GeoState is map(array) of points

func NewGeoState

func NewGeoState() *GeoState

NewGeoState will return a new state {{{

func (*GeoState) Add

func (geost *GeoState) Add(point *GeoPoint)

Add new point with token {{{

func (*GeoState) Clear

func (geost *GeoState) Clear()

Clear state {{{

func (*GeoState) GetPoint

func (geost *GeoState) GetPoint(token string) (point GeoPoint, ok bool)

GetPoint new point with token// {{{

func (*GeoState) Len

func (geost *GeoState) Len() int

Len return lenght state {{{

func (*GeoState) Print

func (geost *GeoState) Print()

Print print poinsts to a dafault stream {{{

func (*GeoState) SetRnd

func (geost *GeoState) SetRnd(num int)

SetRnd fill GeoState the n points {{{

type Server

type Server struct{}

Server structure

func (*Server) NewEngine

func (server *Server) NewEngine(port string)

NewEngine will return gin.server {{{

type TokenReq

type TokenReq struct {
	Token string `form:"Token" binding:"required"`
}

Jump to

Keyboard shortcuts

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