//GetActive gets the active presentations from the Datastore. func GetActive(c appengine.Context) (ps []*Presentation, err error) { q := datastore.NewQuery("Presentation").Filter("Active =", true) is, err := gaemodel.MultiQuery(c, typ, "Presentation", q) if err != nil { return } ps = is.([]*Presentation) return }
func timeQuery(t time.Time, sign string, c appengine.Context) (as []*Activation, err error) { q := datastore.NewQuery("Activation").Filter("Time "+sign, t).Order("Time") is, err := gaemodel.MultiQuery(c, typ, "Activation", q) if err != nil { return } as = is.([]*Activation) return }
//GetListing gets paginated Presentations from Datastore. func GetListing(page int, perPage int, c appengine.Context) (ps []*Presentation, err error) { var q *datastore.Query if page == 1 { q = datastore.NewQuery("Presentation").Limit(perPage).Order("-Active").Order("-Created") } else { q = datastore.NewQuery("Presentation").Limit(perPage).Offset(perPage * (page - 1)).Order("-Active").Order("-Created") } is, err := gaemodel.MultiQuery(c, typ, "Presentation", q) if err != nil { return } ps = is.([]*Presentation) return }