···
type ClickhousePLCEntry struct {
56
-
Did string `ch:"did"`
57
-
Cid string `ch:"cid"`
58
-
Nullified bool `ch:"nullified"`
59
-
CreatedAt time.Time `ch:"created_at"`
60
-
PlcOpSig string `ch:"plc_op_sig"`
61
-
PlcOpPrev *string `ch:"plc_op_prev"`
62
-
PlcOpType string `ch:"plc_op_type"`
63
-
PlcOpServices string `ch:"plc_op_services"`
64
-
PlcOpAlsoKnownAs []string `ch:"plc_op_also_known_as"`
65
-
PlcOpRotationKeys []string `ch:"plc_op_rotation_keys"`
66
-
PlcOpVerificationMethods string `ch:"plc_op_verification_methods"`
67
-
PlcTombSig string `ch:"plc_tomb_sig"`
68
-
PlcTombPrev string `ch:"plc_tomb_prev"`
69
-
PlcTombType string `ch:"plc_tomb_type"`
70
-
LegacyOpSig string `ch:"legacy_op_sig"`
71
-
LegacyOpPrev string `ch:"legacy_op_prev"`
72
-
LegacyOpType string `ch:"legacy_op_type"`
73
-
LegacyOpHandle string `ch:"legacy_op_handle"`
74
-
LegacyOpService string `ch:"legacy_op_service"`
75
-
LegacyOpSigningKey string `ch:"legacy_op_signing_key"`
76
-
LegacyOpRecoveryKey string `ch:"legacy_op_recovery_key"`
56
+
Did string `ch:"did"`
57
+
Cid string `ch:"cid"`
58
+
Nullified bool `ch:"nullified"`
59
+
CreatedAt time.Time `ch:"created_at"`
60
+
PlcOpSig string `ch:"plc_op_sig"`
61
+
PlcOpPrev string `ch:"plc_op_prev"`
62
+
PlcOpType string `ch:"plc_op_type"`
63
+
PlcOpServices []string `ch:"plc_op_services"`
64
+
PlcOpAlsoKnownAs []string `ch:"plc_op_also_known_as"`
65
+
PlcOpRotationKeys []string `ch:"plc_op_rotation_keys"`
66
+
PlcTombSig string `ch:"plc_tomb_sig"`
67
+
PlcTombPrev string `ch:"plc_tomb_prev"`
68
+
PlcTombType string `ch:"plc_tomb_type"`
69
+
LegacyOpSig string `ch:"legacy_op_sig"`
70
+
LegacyOpPrev string `ch:"legacy_op_prev"`
71
+
LegacyOpType string `ch:"legacy_op_type"`
72
+
LegacyOpHandle string `ch:"legacy_op_handle"`
73
+
LegacyOpService string `ch:"legacy_op_service"`
74
+
LegacyOpSigningKey string `ch:"legacy_op_signing_key"`
75
+
LegacyOpRecoveryKey string `ch:"legacy_op_recovery_key"`
func (o *PLCOperationType) UnmarshalJSON(data []byte) error {
···
if e.Operation.PLCOperation != nil {
pop := e.Operation.PLCOperation
137
-
che.PlcOpPrev = pop.Prev
136
+
if pop.Prev != nil {
137
+
che.PlcOpPrev = *pop.Prev
che.PlcOpAlsoKnownAs = pop.AlsoKnownAs
che.PlcOpRotationKeys = pop.RotationKeys
if e.Operation.PLCOperation.Services == nil {
142
-
ps := map[string]PLCService{}
143
-
e.Operation.PLCOperation.Services = ps
146
-
b, err := json.Marshal(e.Operation.PLCOperation.Services)
148
-
return nil, fmt.Errorf("error marshaling services: %w", err)
143
+
for _, s := range e.Operation.PLCOperation.Services {
144
+
che.PlcOpServices = append(che.PlcOpServices, s.Endpoint)
150
-
che.PlcOpServices = string(b)
152
-
if e.Operation.PLCOperation.VerificationMethods == nil {
153
-
vm := map[string]string{}
154
-
e.Operation.PLCOperation.VerificationMethods = vm
157
-
b, err = json.Marshal(e.Operation.PLCOperation.VerificationMethods)
159
-
return nil, fmt.Errorf("error marshaling verification methods: %w", err)
161
-
che.PlcOpVerificationMethods = string(b)
} else if e.Operation.PLCTombstone != nil {
che.PlcTombSig = e.Operation.PLCTombstone.Sig