-
Notifications
You must be signed in to change notification settings - Fork 6
/
scratch.go
37 lines (31 loc) · 913 Bytes
/
scratch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"github.com/chasdevs/meetrics/pkg/apis"
"github.com/chasdevs/meetrics/pkg/conf"
"github.com/chasdevs/meetrics/pkg/data"
"github.com/chasdevs/meetrics/pkg/metrics"
log "github.com/sirupsen/logrus"
"strings"
"time"
)
func init() {
log.SetLevel(log.DebugLevel)
data.Init()
}
func main() {
eventChan := make(chan<- metrics.UserEvent)
user := data.Mgr.GetUserById(82)
metrics.CompileMetricsForUser(time.Date(2017, 11, 7, 0, 0, 0, 0, time.UTC), user, eventChan)
}
func searchUsers(name string) {
adminApi := apis.Admin()
res, err := adminApi.Users.List().Query("name:" + name).Domain(conf.GetString("google.domain")).Do()
if err != nil {
log.Fatalf("Error fetching users for organization: %v", err)
}
emails := make([]string, len(res.Users))
for i, user := range res.Users {
emails[i] = user.PrimaryEmail
}
log.Info("Matching emails: " + strings.Join(emails, ","))
}