From d2aff9a46a20bfd5345fec8a88d2638997a833c0 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 29 Aug 2014 20:50:43 +0800 Subject: Continue working on new admin pages --- models/org.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'models/org.go') diff --git a/models/org.go b/models/org.go index 18ed68e6..ce506705 100644 --- a/models/org.go +++ b/models/org.go @@ -165,6 +165,13 @@ func CountOrganizations() int64 { return count } +// GetOrganizations returns given number of organizations with offset. +func GetOrganizations(num, offset int) ([]*User, error) { + orgs := make([]*User, 0, num) + err := x.Limit(num, offset).Where("type=1").Asc("id").Find(&orgs) + return orgs, err +} + // TODO: need some kind of mechanism to record failure. // DeleteOrganization completely and permanently deletes everything of organization. func DeleteOrganization(org *User) (err error) { -- cgit v1.2.3