-
Notifications
You must be signed in to change notification settings - Fork 0
/
channel_format.go
71 lines (55 loc) · 1.62 KB
/
channel_format.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//go:generate go run github.com/abice/go-enum --file=channel_format.go --names --nocase=true
package v2
import (
"database/sql"
"database/sql/driver"
"github.com/jaehoonkim/synapse/pkg/manager/database/vanilla"
)
/*
ENUM(
disable
fields
jq
)
*/
type FormatType int
// func (enum FormatType) MarshalJSON() ([]byte, error) {
// return []byte(strconv.Quote(enum.String())), nil
// }
// func (enum *FormatType) UnmarshalJSON(data []byte) (err error) {
// s, err := strconv.Unquote(string(data))
// if err != nil {
// return err
// }
// *enum, err = ParseFormatType(s)
// return
// }
// Scan implements the Scanner interface.
func (n *FormatType) Scan(value interface{}) error {
nn := sql.NullInt32{}
if err := nn.Scan(value); err != nil {
return err
}
*n = FormatType(nn.Int32)
return nil
}
// Value implements the driver Valuer interface.
func (n FormatType) Value() (driver.Value, error) {
return int64(n), nil
}
type Format_essential struct {
FormatType FormatType `column:"format_type,default(0)" json:"format_type,omitempty" enums:"0,1,2"` // enums:"disable(0), fields(1), jq(2)"
FormatData string `column:"format_data,default('')" json:"format_data,omitempty"`
}
type Format_property struct {
Format_essential `json:",inline"`
Created vanilla.NullTime `column:"created" json:"created,omitempty" swaggertype:"string"`
Updated vanilla.NullTime `column:"updated" json:"updated,omitempty" swaggertype:"string"`
}
func (Format_property) TableName() string {
return "managed_channel_format"
}
type Format struct {
Format_property `json:",inline"`
Uuid string `column:"uuid" json:"uuid,omitempty"` // pk
}