utils

package
v0.0.0-...-3b07eb7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GoogleApiUri   = "https://maps.googleapis.com/maps/api/geocode/json?key={key}&address="
	GoogleApiKey   = ""
	MozillaLinuxUA = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
)
View Source
const TokenAuthSecret = "/v1/api/S3cr3T"

Variables

View Source
var ShowMeLog = true

Functions

func Dumper

func Dumper(infos ...interface{})

func HttpGet

func HttpGet(url string, hdrs map[string]string) (string, int, error)

HttpGet send request to remote end-point-urls (GET)

func HttpInit

func HttpInit()

HttpInit initialize the http global

func HttpPost

func HttpPost(url, body string, hdrs map[string]string) (string, int, error)

HttpPost send request to remote end-point-urls (POST)

Types

type AppJwtConfig

type AppJwtConfig struct {
	TokenAuth *jwtauth.JWTAuth `json:",omitempty"`
}
var AppJwtToken *AppJwtConfig

func NewAppJwtConfig

func NewAppJwtConfig() *AppJwtConfig

func (*AppJwtConfig) GenToken

func (t *AppJwtConfig) GenToken(claims jwt.MapClaims) (string, error)

type Coordinates

type Coordinates struct {
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lng"`
}

type Geometry

type Geometry struct {
	Geometry         Location `json:"geometry"`
	FormattedAddress string   `json:"formatted_address"`
}

type GoogleApiResponse

type GoogleApiResponse struct {
	Results Results `json:"results"`
	Status  string  `json:"status"`
}

type GoogleMapGeoCode

type GoogleMapGeoCode struct {
	Key     string `json:"key"`
	Address string `json:"address"`
}

func NewGoogleMapGeoCode

func NewGoogleMapGeoCode(key string) *GoogleMapGeoCode

NewGoogleMapGeoCode geo-code

func (*GoogleMapGeoCode) GetCoordinates

func (g *GoogleMapGeoCode) GetCoordinates(address string) (bool, *models.Location, error)

GetCoordinates get the geo code info as per address

type Location

type Location struct {
	Location Coordinates `json:"location"`
}

type Results

type Results []Geometry

Jump to

Keyboard shortcuts

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