-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_category.go
52 lines (42 loc) · 1010 Bytes
/
event_category.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
45
46
47
48
49
50
51
52
package v2
import (
"database/sql"
"database/sql/driver"
)
//go:generate go run github.com/abice/go-enum --file=event_category.go --names --nocase=true
/* ENUM(
NaV
nonspecified
client-auth-accept
service-polling-out
service-polling-in
)
*/
type EventCategory int
// func (enum EventCategory) MarshalJSON() ([]byte, error) {
// return []byte(strconv.Quote(enum.String())), nil
// }
// func (enum *EventCategory) UnmarshalJSON(data []byte) (err error) {
// s, err := strconv.Unquote(string(data))
// if err != nil {
// return err
// }
// *enum, err = ParseEventCategory(s)
// return
// }
// Scan implements the Scanner interface.
func (n *EventCategory) Scan(value interface{}) error {
nn := sql.NullInt32{}
if err := nn.Scan(value); err != nil {
return err
}
*n = EventCategory(nn.Int32)
return nil
}
// Value implements the driver Valuer interface.
func (n EventCategory) Value() (driver.Value, error) {
if n == EventCategoryNaV {
return nil, nil
}
return int64(n), nil
}