-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchange.go
More file actions
33 lines (26 loc) · 725 Bytes
/
change.go
File metadata and controls
33 lines (26 loc) · 725 Bytes
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
// SPDX-FileCopyrightText: © 2024 Kevin Conway <kevin@conway0.com>
// SPDX-License-Identifier: Apache-2.0
package cdc
import (
"encoding/json"
"fmt"
"time"
)
type Change struct {
Table string `json:"table"`
Timestamp time.Time `json:"timestamp"`
Operation Operation `json:"operation"`
Before json.RawMessage `json:"before"`
After json.RawMessage `json:"after"`
}
type Operation string
const (
Insert Operation = "INSERT"
Update Operation = "UPDATE"
Delete Operation = "DELETE"
Bootstrap Operation = "BOOTSTRAP"
)
func (c Change) String() string {
return fmt.Sprintf("%s: %s %s", c.Timestamp.Format(time.RFC3339Nano), c.Table, c.Operation)
}
type Changes []Change