-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathactivity_type.go
39 lines (37 loc) · 1.01 KB
/
activity_type.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
package models
type ActivityType int
const (
SIGNIN_ACTIVITYTYPE ActivityType = iota
USER_ACTIVITYTYPE
UNKNOWNFUTUREVALUE_ACTIVITYTYPE
SERVICEPRINCIPAL_ACTIVITYTYPE
)
func (i ActivityType) String() string {
return []string{"signin", "user", "unknownFutureValue", "servicePrincipal"}[i]
}
func ParseActivityType(v string) (any, error) {
result := SIGNIN_ACTIVITYTYPE
switch v {
case "signin":
result = SIGNIN_ACTIVITYTYPE
case "user":
result = USER_ACTIVITYTYPE
case "unknownFutureValue":
result = UNKNOWNFUTUREVALUE_ACTIVITYTYPE
case "servicePrincipal":
result = SERVICEPRINCIPAL_ACTIVITYTYPE
default:
return nil, nil
}
return &result, nil
}
func SerializeActivityType(values []ActivityType) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i ActivityType) isMultiValue() bool {
return false
}