コード例 #1
0
ファイル: presentation.go プロジェクト: sellweek/TOGY-server
//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
}
コード例 #2
0
ファイル: activation.go プロジェクト: sellweek/TOGY-server
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
}
コード例 #3
0
ファイル: presentation.go プロジェクト: sellweek/TOGY-server
//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
}