Row: Add GetFinalRows()

This commit is contained in:
Noah Hilverling 2019-08-07 15:19:54 +02:00
parent bc1c4b1c0f
commit 618ea21571
48 changed files with 193 additions and 0 deletions

View file

@ -53,6 +53,10 @@ func (a *ActionUrl) SetId(id string) {
a.Id = id
}
func (a *ActionUrl) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{a}, nil
}
func init() {
name := "action_url"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (c *CheckCommand) SetId(id string) {
c.Id = id
}
func (c *CheckCommand) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "checkcommand"
ObjectInformation = configobject.ObjectInformation{

View file

@ -82,6 +82,10 @@ func (c *CheckCommandArgument) SetId(id string) {
c.Id = id
}
func (c *CheckCommandArgument) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "checkcommand_argument"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *CheckCommandCustomvar) SetId(id string) {
c.Id = id
}
func (c *CheckCommandCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "checkcommand_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -61,6 +61,10 @@ func (c *CheckCommandEnvvar) SetId(id string) {
c.Id = id
}
func (c *CheckCommandEnvvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "checkcommand_envvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -59,6 +59,10 @@ func (c *Customvar) SetId(id string) {
c.Id = id
}
func (c *Customvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -66,6 +66,10 @@ func (e *Endpoint) SetId(id string) {
e.Id = id
}
func (e *Endpoint) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{e}, nil
}
func init() {
name := "endpoint"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (c *EventCommand) SetId(id string) {
c.Id = id
}
func (c *EventCommand) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "eventcommand"
ObjectInformation = configobject.ObjectInformation{

View file

@ -82,6 +82,10 @@ func (c *EventCommandArgument) SetId(id string) {
c.Id = id
}
func (c *EventCommandArgument) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "eventcommand_argument"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *EventCommandCustomvar) SetId(id string) {
c.Id = id
}
func (c *EventCommandCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "eventcommand_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -61,6 +61,10 @@ func (c *EventCommandEnvvar) SetId(id string) {
c.Id = id
}
func (c *EventCommandEnvvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "eventcommand_envvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -168,6 +168,10 @@ func (h *Host) SetId(id string) {
h.Id = id
}
func (h *Host) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "host"
ObjectInformation = configobject.ObjectInformation{

View file

@ -83,6 +83,10 @@ func (h *HostComment) SetId(id string) {
h.Id = id
}
func (h *HostComment) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "host_comment"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *HostCustomvar) SetId(id string) {
c.Id = id
}
func (h *HostCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "host_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -95,6 +95,10 @@ func (h *HostDowntime) SetId(id string) {
h.Id = id
}
func (h *HostDowntime) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "host_downtime"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (h *Hostgroup) SetId(id string) {
h.Id = id
}
func (h *Hostgroup) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "hostgroup"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *HostgroupCustomvar) SetId(id string) {
c.Id = id
}
func (h *HostgroupCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "hostgroup_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (h *HostgroupMember) SetId(id string) {
h.Id = id
}
func (h *HostgroupMember) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{h}, nil
}
func init() {
name := "hostgroup_member"
ObjectInformation = configobject.ObjectInformation{

View file

@ -53,6 +53,10 @@ func (a *IconImage) SetId(id string) {
a.Id = id
}
func (a *IconImage) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{a}, nil
}
func init() {
name := "icon_image"
ObjectInformation = configobject.ObjectInformation{

View file

@ -53,6 +53,10 @@ 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{

View file

@ -102,6 +102,10 @@ func (n *Notification) SetId(id string) {
n.Id = id
}
func (n *Notification) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{n}, nil
}
func init() {
name := "notification"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *NotificationCustomvar) SetId(id string) {
c.Id = id
}
func (c *NotificationCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "notification_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (n *NotificationUser) SetId(id string) {
n.Id = id
}
func (n *NotificationUser) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{n}, nil
}
func init() {
name := "notification_user"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (n *NotificationUsergroup) SetId(id string) {
n.Id = id
}
func (n *NotificationUsergroup) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{n}, nil
}
func init() {
name := "notification_usergroup"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (c *NotificationCommand) SetId(id string) {
c.Id = id
}
func (c *NotificationCommand) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "notificationcommand"
ObjectInformation = configobject.ObjectInformation{

View file

@ -82,6 +82,10 @@ func (c *NotificationCommandArgument) SetId(id string) {
c.Id = id
}
func (c *NotificationCommandArgument) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "notificationcommand_argument"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *NotificationCommandCustomvar) SetId(id string) {
c.Id = id
}
func (c *NotificationCommandCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "notificationcommand_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -61,6 +61,10 @@ func (c *NotificationCommandEnvvar) SetId(id string) {
c.Id = id
}
func (c *NotificationCommandEnvvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "notificationcommand_envvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -159,6 +159,10 @@ func (s *Service) SetId(id string) {
s.Id = id
}
func (s *Service) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{s}, nil
}
func init() {
name := "service"
ObjectInformation = configobject.ObjectInformation{

View file

@ -83,6 +83,10 @@ func (s *ServiceComment) SetId(id string) {
s.Id = id
}
func (s *ServiceComment) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{s}, nil
}
func init() {
name := "service_comment"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *ServiceCustomvar) SetId(id string) {
c.Id = id
}
func (c *ServiceCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "service_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -95,6 +95,10 @@ func (s *ServiceDowntime) SetId(id string) {
s.Id = id
}
func (s *ServiceDowntime) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{s}, nil
}
func init() {
name := "service_downtime"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (s *Servicegroup) SetId(id string) {
s.Id = id
}
func (s *Servicegroup) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{s}, nil
}
func init() {
name := "servicegroup"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *ServicegroupCustomvar) SetId(id string) {
c.Id = id
}
func (c *ServicegroupCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "servicegroup_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (s *ServicegroupMember) SetId(id string) {
s.Id = id
}
func (s *ServicegroupMember) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{s}, nil
}
func init() {
name := "servicegroup_member"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (t *Timeperiod) SetId(id string) {
t.Id = id
}
func (t *Timeperiod) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{t}, nil
}
func init() {
name := "timeperiod"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *TimeperiodCustomvar) SetId(id string) {
c.Id = id
}
func (c *TimeperiodCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "timeperiod_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (t *TimeperiodOverrideExclude) SetId(id string) {
t.Id = id
}
func (t *TimeperiodOverrideExclude) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{t}, nil
}
func init() {
name := "timeperiod_override_exclude"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (t *TimeperiodOverrideInclude) SetId(id string) {
t.Id = id
}
func (t *TimeperiodOverrideInclude) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{t}, nil
}
func init() {
name := "timeperiod_override_include"
ObjectInformation = configobject.ObjectInformation{

View file

@ -58,6 +58,10 @@ func (t *TimeperiodRange) SetId(id string) {
t.Id = id
}
func (t *TimeperiodRange) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{t}, nil
}
func init() {
name := "timeperiod_range"
ObjectInformation = configobject.ObjectInformation{

View file

@ -93,6 +93,10 @@ func (u *User) SetId(id string) {
u.Id = id
}
func (u *User) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{u}, nil
}
func init() {
name := "user"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *UserCustomvar) SetId(id string) {
c.Id = id
}
func (c *UserCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "user_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -72,6 +72,10 @@ func (u *Usergroup) SetId(id string) {
u.Id = id
}
func (u *Usergroup) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{u}, nil
}
func init() {
name := "usergroup"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (c *UsergroupCustomvar) SetId(id string) {
c.Id = id
}
func (c *UsergroupCustomvar) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{c}, nil
}
func init() {
name := "usergroup_customvar"
ObjectInformation = configobject.ObjectInformation{

View file

@ -55,6 +55,10 @@ func (u *UsergroupMember) SetId(id string) {
u.Id = id
}
func (u *UsergroupMember) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{u}, nil
}
func init() {
name := "usergroup_member"
ObjectInformation = configobject.ObjectInformation{

View file

@ -75,6 +75,10 @@ func (z *Zone) SetId(id string) {
z.Id = id
}
func (z *Zone) GetFinalRows() ([]connection.Row, error) {
return []connection.Row{z}, nil
}
func init() {
name := "zone"
ObjectInformation = configobject.ObjectInformation{

View file

@ -623,6 +623,14 @@ func (dbw *DBWrapper) SqlBulkInsert(rows []Row, stmt *BulkInsertStmt) error {
return nil
}
finalRows := make([]Row, 0)
for _, r := range rows {
fr, _ := r.GetFinalRows()
finalRows = append(finalRows, fr...)
}
rows = finalRows
DbBulkInserts.Inc()
placeholders := make([]string, len(rows))

View file

@ -429,6 +429,7 @@ type Row interface {
UpdateValues() []interface{}
GetId() string
SetId(id string)
GetFinalRows() ([]Row, error)
}
type RowFactory func() Row