Skip to content

Commit

Permalink
Fix 'TODO' for 'ProtobufConverter.entry'.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickeskov committed Dec 7, 2023
1 parent a8ebf30 commit 3af1f55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/proto/protobuf_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ func (c *ProtobufConverter) entry(entry *g.DataEntry) DataEntry {
return nil
}
var e DataEntry
switch t := entry.Value.(type) { // TODO: change delete data entry to "case nil" and return an error in default
switch t := entry.Value.(type) {
case *g.DataEntry_IntValue:
e = &IntegerDataEntry{Key: entry.Key, Value: t.IntValue}
case *g.DataEntry_BoolValue:
Expand All @@ -743,8 +743,10 @@ func (c *ProtobufConverter) entry(entry *g.DataEntry) DataEntry {
e = &BinaryDataEntry{Key: entry.Key, Value: t.BinaryValue}
case *g.DataEntry_StringValue:
e = &StringDataEntry{Key: entry.Key, Value: t.StringValue}
default: // No value means DeleteDataEntry
case nil:
e = &DeleteDataEntry{Key: entry.Key}
default:
c.err = errors.Errorf("unknown data entry value type (%T)", entry.Value)
}
return e
}
Expand Down

0 comments on commit 3af1f55

Please sign in to comment.