-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Description
I'm trying to upgrade my project from go1 to go111.
In my project I'm using datastore, here you can see how my code looks:
package controller
import (
"google.golang.org/appengine/datastore"
"log"
"net/http"
"time"
)
type Measurement struct {
Project string `datastore:"project"`
At time.Time `datastore:"at"`
Took int `datastore:"took,noindex"`
ResponseCode int `datastore:"responseCode"`
}
func MeasurementController(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
query := datastore.NewQuery("Measurement")
data := make([]Measurement, 0)
keys, err := query.GetAll(ctx, &data)
if err != nil {
log.Printf("Error %#v", err)
return
}
log.Printf("Keys: %+v, Data: %+v", keys, data)
}And I always get error: Error: &errors.errorString{s:"not an App Engine context"}
As you can see I've already replaced ctx := appengine.NewContext(r) to ctx := r.Context()
but it won't work.
Sof31t
Metadata
Metadata
Assignees
Labels
No labels