1
0
Fork 0
empact/db/org.go

21 lines
418 B
Go
Raw Normal View History

2015-03-05 15:25:26 +00:00
package db
2015-03-06 13:35:13 +00:00
import (
"time"
)
2015-03-06 10:00:04 +00:00
type Org struct {
Login string `json:"login"`
Descr string `json:"descr"`
2015-03-06 11:18:15 +00:00
ID uint64 `json:"id"`
2015-03-06 10:00:04 +00:00
AvatarURL string `json:"avatar_url"`
}
2015-03-05 15:25:26 +00:00
2015-03-06 10:00:04 +00:00
const userOrgsQuery = `select o.* from members m join orgs o on o.login = m.org where user = ?`
2015-03-05 15:25:26 +00:00
2015-03-05 16:06:45 +00:00
func UserOrgs(login string) (orgs []*Org) {
2015-03-06 13:35:13 +00:00
defer measure("UserOrgs", time.Now())
2015-03-06 11:29:52 +00:00
mustSelect(&orgs, userOrgsQuery, login)
2015-03-05 15:25:26 +00:00
return
}