Skip to content

Instantly share code, notes, and snippets.

@vkeenan
Created February 22, 2021 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkeenan/9a2e1a82fcae6beb77cd52bd4ad8edc4 to your computer and use it in GitHub Desktop.
Save vkeenan/9a2e1a82fcae6beb77cd52bd4ad8edc4 to your computer and use it in GitHub Desktop.
package geo
import (
"fmt"
"net/http"
"github.com/go-openapi/runtime/middleware"
"taxnexus.io/geo/models"
"taxnexus.io/geo/restapi/operations/coordinate"
)
// GetCoordinateBasic is a handler function
func GetCoordinateBasic(params coordinate.GetCoordinateBasicParams, principal *app.User) middleware.Responder {
sugar.Debugf("geo.GetCoordinateBasic: 📥")
var obj *Coordinate
var err error
if params.Address != nil {
obj, err = determineCoordinate(*params.Address, params.Ref)
sugar.Infof("geo.GetCoordinateBasic: 👍 %s", *params.Address)
return coordinate.NewGetCoordinateBasicOK().WithPayload(
&models.CoordinateBasicResponse{
Data: []*models.CoordinateBasic{obj.marshalToBasic()},
Meta: newResponseMeta(),
}).
WithAccessControlAllowOrigin(corsOrigin).
WithCacheControl(cacheTime)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment