44 lines
949 B
Go
44 lines
949 B
Go
package domain
|
|
|
|
type EventType string
|
|
|
|
func (e EventType) String() string {
|
|
return string(e)
|
|
}
|
|
|
|
const (
|
|
EventTypeInsert EventType = "INSERT"
|
|
EventTypeUpdate EventType = "UPDATE"
|
|
EventTypeDelete EventType = "DELETE"
|
|
EventTypeTruncate EventType = "TRUNCATE"
|
|
)
|
|
|
|
func NewValues() *Values {
|
|
return &Values{
|
|
Key: make(map[string]any),
|
|
Data: make(map[string]any),
|
|
}
|
|
}
|
|
|
|
func (v *Values) AddValue(partOfKey bool, key string, value any) {
|
|
if partOfKey {
|
|
v.Key[key] = value
|
|
} else {
|
|
v.Data[key] = value
|
|
}
|
|
}
|
|
|
|
type Values struct {
|
|
Key map[string]any
|
|
Data map[string]any
|
|
}
|
|
|
|
type ReplicationEvent struct {
|
|
EventType EventType `json:"eventType"`
|
|
TransactionId uint32 `json:"transactionId"`
|
|
DBName string `json:"dbName"`
|
|
Namespace string `json:"namespace"`
|
|
Relation string `json:"relation"`
|
|
NewValues *Values `json:"newValues,omitempty"`
|
|
OldValues *Values `json:"oldValues,omitempty"`
|
|
}
|