-
Notifications
You must be signed in to change notification settings - Fork 25
/
notice_model.go
44 lines (39 loc) · 1.26 KB
/
notice_model.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 model
import (
"fmt"
"github.com/scryinfo/dot/dots/db/pgs"
)
const (
Notice_Table = "notices"
Notice_Struct = "notice"
Notice_ID = "id"
Notice_UpdateTime = "update_time"
Notice_CreateTime = "create_time"
Notice_OptimisticLockVersion = "optimistic_lock_version"
Notice_Data = "data"
Notice_Status = "status"
Notice_No = "no"
)
func (m *Notice) String() string {
//todo please change the format string
//m.ID, m.UpdateTime, m.CreateTime, m.OptimisticLockVersion, m.Data, m.Status, m.No,
str := fmt.Sprintf("Notice<%s >",
m.ID,
)
return str
}
func (m *Notice) ToMap() map[string]string {
res := pgs.ToMap(m, map[string]bool{})
return res
}
func (m *Notice) ToUpsertSet() []string {
res := []string{
fmt.Sprintf("%s = EXCLUDED.%s", Notice_ID, Notice_ID),
fmt.Sprintf("%s = EXCLUDED.%s", Notice_UpdateTime, Notice_UpdateTime),
fmt.Sprintf("%s = EXCLUDED.%s", Notice_CreateTime, Notice_CreateTime),
fmt.Sprintf("%s = EXCLUDED.%s", Notice_OptimisticLockVersion, Notice_OptimisticLockVersion),
fmt.Sprintf("%s = EXCLUDED.%s", Notice_Data, Notice_Data),
fmt.Sprintf("%s = EXCLUDED.%s", Notice_Status, Notice_Status),
}
return res
}