/
notesurl.go
74 lines (59 loc) · 1.43 KB
/
notesurl.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
72
73
74
// IcingaDB | (c) 2019 Icinga GmbH | GPLv2+
package notesurl
import (
"github.com/Icinga/icingadb/configobject"
"github.com/Icinga/icingadb/connection"
"github.com/Icinga/icingadb/utils"
)
var (
ObjectInformation configobject.ObjectInformation
Fields = []string{
"id",
"environment_id",
"notes_url",
}
)
type NotesUrl struct {
Id string `json:"id"`
EnvId string `json:"environment_id"`
NotesUrl string `json:"notes_url"`
}
func NewNotesUrl() connection.Row {
a := NotesUrl{}
return &a
}
func (a *NotesUrl) InsertValues() []interface{} {
v := a.UpdateValues()
return append([]interface{}{utils.EncodeChecksum(a.Id)}, v...)
}
func (a *NotesUrl) UpdateValues() []interface{} {
v := make([]interface{}, 0)
v = append(
v,
utils.EncodeChecksum(a.EnvId),
a.NotesUrl,
)
return v
}
func (a *NotesUrl) GetId() string {
return a.Id
}
func (a *NotesUrl) SetId(id string) {
a.Id = id
}
func (a *NotesUrl) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{a}, nil
}
func init() {
name := "notes_url"
ObjectInformation = configobject.ObjectInformation{
ObjectType: name,
RedisKey: name,
PrimaryMySqlField: "id",
Factory: NewNotesUrl,
HasChecksum: false,
BulkInsertStmt: connection.NewBulkInsertStmt(name, Fields),
BulkDeleteStmt: connection.NewBulkDeleteStmt(name, "id"),
BulkUpdateStmt: connection.NewBulkUpdateStmt(name, Fields),
}
}