Skip to content

Commit

Permalink
feature/link-statically-against-TF #83 Add NewLocation() function
Browse files Browse the repository at this point in the history
  • Loading branch information
graciousgrey committed Jan 17, 2020
1 parent 492a983 commit 8f939d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/maps/location.go
Expand Up @@ -44,9 +44,16 @@ type LocationSource interface {
Source() string
}

func NewLocation(id string) *Location {
func NewLocation(id string, name string, category string, label string, city string, state string, country string, source string) *Location {
result := &Location{
ID: id,
ID: id,
LocName: name,
LocCategory: category,
LocLabel: label,
LocCity: city,
LocState: state,
LocCountry: country,
LocSource: source,
}

return result
Expand Down
13 changes: 13 additions & 0 deletions internal/maps/places/location.go
Expand Up @@ -23,6 +23,19 @@ type Location struct {

var ReverseLookupURL = "https://places.photoprism.org/v1/location/%s"

func NewLocation(id string, lat float64, lng float64, name string, category string, place Place, cached bool) *Location {
result := &Location{
ID: id,
LocLat: lat,
LocLng: lng,
LocName: name,
LocCategory: category,
Place: place,
Cached: cached,
}

return result
}
func FindLocation(id string) (result Location, err error) {
if len(id) > 16 || len(id) == 0 {
return result, fmt.Errorf("places: invalid location id %s", id)
Expand Down

0 comments on commit 8f939d2

Please sign in to comment.