-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateReplicationSlotSource.go
More file actions
46 lines (38 loc) · 1013 Bytes
/
createReplicationSlotSource.go
File metadata and controls
46 lines (38 loc) · 1013 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
34
35
36
37
38
39
40
41
42
43
44
45
46
package postgres
import (
"encoding/json"
)
var (
_ json.Unmarshaler = new(CreateReplicationSlotSource)
)
type CreateReplicationSlotSource struct {
SlotName string `json:"SlotName"`
Plugin string `json:"Plugin"`
Temporary bool `json:"Temporary"`
SlotType ReplicationMode `json:"SlotType"`
SnapshotAction string `json:"SnapshotAction"`
}
// UnmarshalJSON implements json.Unmarshaler.
func (s *CreateReplicationSlotSource) UnmarshalJSON(data []byte) error {
type Alias CreateReplicationSlotSource
dummy := &struct {
*Alias
SlotType string `yaml:"SlotType"`
}{
Alias: (*Alias)(s),
}
if err := json.Unmarshal(data, &dummy); err != nil {
return err
}
t, err := ParseReplicationMode(dummy.SlotType)
if err != nil {
return err
}
s.SlotType = t
return nil
}
func (s *CreateReplicationSlotSource) AsProvider() CreateReplicationSlotSourceProvider {
var p CreateReplicationSlotSourceProvider
p.AppendSource(*s)
return p
}