diff --git a/admin.go b/admin.go index 7beaae1..823e20d 100644 --- a/admin.go +++ b/admin.go @@ -32,7 +32,7 @@ import ( func AllFeedsOpml(c mpg.Context, w http.ResponseWriter, r *http.Request) { gn := goon.FromContext(c) - q := datastore.NewQuery(gn.Key(&Feed{}).Kind()).KeysOnly() + q := datastore.NewQuery(gn.Kind(&Feed{})).KeysOnly() keys, _ := gn.GetAll(q, nil) fs := make([]*Feed, len(keys)) for i, k := range keys { @@ -63,7 +63,7 @@ func feedsToOpml(feeds []*Feed) []byte { func AllFeeds(c mpg.Context, w http.ResponseWriter, r *http.Request) { gn := goon.FromContext(c) - q := datastore.NewQuery(gn.Key(&Feed{}).Kind()).KeysOnly() + q := datastore.NewQuery(gn.Kind(&Feed{})).KeysOnly() keys, _ := gn.GetAll(q, nil) templates.ExecuteTemplate(w, "admin-all-feeds.html", keys) } @@ -75,7 +75,7 @@ func AdminFeed(c mpg.Context, w http.ResponseWriter, r *http.Request) { serveError(w, err) return } - q := datastore.NewQuery(gn.Key(&Story{}).Kind()).KeysOnly() + q := datastore.NewQuery(gn.Kind(&Story{})).KeysOnly() fk := gn.Key(&f) q = q.Ancestor(fk) q = q.Limit(100) @@ -159,7 +159,7 @@ func AdminDateFormats(c mpg.Context, w http.ResponseWriter, r *http.Request) { func AdminStats(c mpg.Context, w http.ResponseWriter, r *http.Request) { gn := goon.FromContext(c) - uc, _ := datastore.NewQuery(gn.Key(&User{}).Kind()).Count(c) + uc, _ := datastore.NewQuery(gn.Kind(&User{})).Count(c) templates.ExecuteTemplate(w, "admin-stats.html", struct { Users int }{ @@ -169,7 +169,7 @@ func AdminStats(c mpg.Context, w http.ResponseWriter, r *http.Request) { func AdminUser(c mpg.Context, w http.ResponseWriter, r *http.Request) { gn := goon.FromContext(c) - q := datastore.NewQuery(gn.Key(&User{}).Kind()).Limit(1) + q := datastore.NewQuery(gn.Kind(&User{})).Limit(1) q = q.Filter("e =", r.FormValue("u")) it := gn.Run(q) var u User @@ -185,7 +185,7 @@ func AdminUser(c mpg.Context, w http.ResponseWriter, r *http.Request) { u.Until = d gn.Put(&u) } - q = datastore.NewQuery(gn.Key(&Log{}).Kind()).Ancestor(k) + q = datastore.NewQuery(gn.Kind(&Log{})).Ancestor(k) _, err = gn.GetAll(q, &h) ud.Parent = gn.Key(&u) gn.Get(&ud) diff --git a/user.go b/user.go index 4fbc61a..950d013 100644 --- a/user.go +++ b/user.go @@ -238,7 +238,7 @@ func ListFeeds(c mpg.Context, w http.ResponseWriter, r *http.Request) { }) lock := sync.Mutex{} fl := make(map[string][]*Story) - q := datastore.NewQuery(gn.Key(&Story{}).Kind()). + q := datastore.NewQuery(gn.Kind(&Story{})). Filter(IDX_COL+" >=", u.Read). KeysOnly(). Order("-" + IDX_COL). @@ -318,7 +318,7 @@ func ListFeeds(c mpg.Context, w http.ResponseWriter, r *http.Request) { close(queue) c.Step("stars", func(c mpg.Context) { gn := goon.FromContext(c) - q := datastore.NewQuery(gn.Key(&UserStar{}).Kind()). + q := datastore.NewQuery(gn.Kind(&UserStar{})). Ancestor(ud.Parent). KeysOnly(). Filter("c >=", u.Read). @@ -600,7 +600,7 @@ func ClearFeeds(c mpg.Context, w http.ResponseWriter, r *http.Request) { &UserOpml{}, } for _, i := range types { - k := gn.Key(i).Kind() + k := gn.Kind(i) go del(k) } @@ -707,7 +707,7 @@ func FeedHistory(c mpg.Context, w http.ResponseWriter, r *http.Request) { u := User{Id: cu.ID} uk := gn.Key(&u) if v := r.FormValue("v"); len(v) == 0 { - q := datastore.NewQuery(gn.Key(&UserOpml{}).Kind()).Ancestor(uk).KeysOnly() + q := datastore.NewQuery(gn.Kind(&UserOpml{})).Ancestor(uk).KeysOnly() keys, err := gn.GetAll(q, nil) if err != nil { serveError(w, err) @@ -755,7 +755,7 @@ func GetFeed(c mpg.Context, w http.ResponseWriter, r *http.Request) { var stars []string wg := sync.WaitGroup{} fk := gn.Key(&f) - q := datastore.NewQuery(gn.Key(&Story{}).Kind()).Ancestor(fk).KeysOnly() + q := datastore.NewQuery(gn.Kind(&Story{})).Ancestor(fk).KeysOnly() q = q.Order("-" + IDX_COL) if cur := r.FormValue("c"); cur != "" { if dc, err := datastore.DecodeCursor(cur); err == nil { @@ -767,7 +767,7 @@ func GetFeed(c mpg.Context, w http.ResponseWriter, r *http.Request) { go c.Step("stars", func(c mpg.Context) { gn := goon.FromContext(c) usk := starKey(c, f.Url, "") - q := datastore.NewQuery(gn.Key(&UserStar{}).Kind()).Ancestor(gn.Key(usk).Parent()).KeysOnly() + q := datastore.NewQuery(gn.Kind(&UserStar{})).Ancestor(gn.Key(usk).Parent()).KeysOnly() keys, _ := gn.GetAll(q, nil) stars = make([]string, len(keys)) for i, key := range keys { @@ -856,7 +856,7 @@ func GetStars(c mpg.Context, w http.ResponseWriter, r *http.Request) { gn := goon.FromContext(c) cu := user.Current(c) u := User{Id: cu.ID} - q := datastore.NewQuery(gn.Key(&UserStar{}).Kind()). + q := datastore.NewQuery(gn.Kind(&UserStar{})). Ancestor(gn.Key(&u)). Order("-c"). Limit(20)