-
Notifications
You must be signed in to change notification settings - Fork 0
/
users_mapping.go
44 lines (40 loc) · 1.13 KB
/
users_mapping.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
38
39
40
41
42
43
44
package sitrep
import (
"time"
"github.com/gocql/gocql"
)
// UsersSafeReturn represent safe user fields
type UsersSafeReturn struct {
IsAdmin bool
IsAnalyzed bool
IsBanned bool
AccessValidTill time.Time
UserRank string
UserSelfDescription string
TwitterName string
UserTitle string
UserUnit string
Email string
RealName string
}
//MapUsersToSafe returns save user records
func MapUsersToSafe(iter *gocql.Iter) ([]UsersSafeReturn, error) {
var array []UsersSafeReturn
err := MapUsersByEmail(iter, func(t UsersByEmail) (bool, error) {
array = append(array, UsersSafeReturn{
IsAdmin: t.IsAdmin,
IsAnalyzed: t.IsAnalyzed,
IsBanned: t.IsBanned,
AccessValidTill: t.AccessValidTill,
UserRank: t.UserRank,
UserSelfDescription: t.UserSelfDescription,
TwitterName: t.TwitterName,
UserTitle: t.UserTitle,
UserUnit: t.UserUnit,
Email: t.Email,
RealName: t.RealName,
})
return true, nil
})
return array, err
}