location

package
v0.0.0-...-2a3cdc3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: MIT, MIT Imports: 6 Imported by: 0

README

Location

Location picks up location details from an interactive Google Map widget when creating/editing any applicable Resource in Qor Admin.

Usage

To use Location with QOR Admin, simply embed location.Location in a model then behold the map picker in the QOR Admin interface.

import (
  "github.com/jinzhu/gorm"
  "github.com/qor/location"
)

type Store struct {
  gorm.Model
  Name string
  location.Location
}

Embedded location.Location brings these attributes to your struct

type Location struct {
  Address   string
  City      string
  Region    string
  Country   string
  Zip       string
  Latitude  float64
  Longitude float64
}

Now, you can call Store.Address or Store.Country etc. to get the address of the store.

Location Demo: http://demo.getqor.com/admin/setting

License

Released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// GoogleAPIKey Key of Google Map API
	GoogleAPIKey string
	// BaiduAPIKey Key of Baidu Map API
	BaiduAPIKey string
)

Functions

This section is empty.

Types

type Location

type Location struct {
	Address   string
	City      string
	Region    string
	Country   string
	Zip       string
	Latitude  float64
	Longitude float64
}

Location is a struct, you could embedded it into your model to get the Location feature for your model

func (*Location) ConfigureQorResource

func (*Location) ConfigureQorResource(res resource.Resourcer)

ConfigureQorResource configure qor locale for Qor Admin

func (*Location) GetLocation

func (location *Location) GetLocation() *Location

GetLocation get location from your model

type LocationConfig

type LocationConfig struct {
	Backend      string
	BaiduAPIKey  string
	GoogleAPIKey string
}

LocationConfig Location Meta's Config

func (*LocationConfig) ConfigureQorMeta

func (locationConfig *LocationConfig) ConfigureQorMeta(meta resource.Metaor)

ConfigureQorMeta configure Qor Meta to implement MetaConfig interface

Jump to

Keyboard shortcuts

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