File: updates.go

package info (click to toggle)
golang-github-ovn-org-libovsdb 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 1,440 kB
  • sloc: makefile: 52; sh: 14
file content (35 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (2)
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
package ovsdb

// TableUpdates is an object that maps from a table name to a
// TableUpdate
type TableUpdates map[string]TableUpdate

// TableUpdate is an object that maps from the row's UUID to a
// RowUpdate
type TableUpdate map[string]*RowUpdate

// RowUpdate represents a row update according to RFC7047
type RowUpdate struct {
	New *Row `json:"new,omitempty"`
	Old *Row `json:"old,omitempty"`
}

// Insert returns true if this is an update for an insert operation
func (r RowUpdate) Insert() bool {
	return r.New != nil && r.Old == nil
}

// Modify returns true if this is an update for a modify operation
func (r RowUpdate) Modify() bool {
	return r.New != nil && r.Old != nil
}

// Delete returns true if this is an update for a delete operation
func (r RowUpdate) Delete() bool {
	return r.New == nil && r.Old != nil
}

func (r *RowUpdate) FromRowUpdate2(ru2 RowUpdate2) {
	r.Old = ru2.Old
	r.New = ru2.New
}