Skip to content

Commit

Permalink
simplify switch statemetn
Browse files Browse the repository at this point in the history
  • Loading branch information
fredcarle committed Apr 2, 2024
1 parent 51b2853 commit c7a8713
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions merkle/crdt/merklecrdt.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,42 +79,23 @@ func InstanceWithStore(
key,
fieldName,
), nil
case client.PN_COUNTER:
case client.PN_COUNTER, client.P_COUNTER:
switch kind {
case client.FieldKind_NILLABLE_INT:
return NewMerkleCounter[int64](
store,
schemaVersionKey,
key,
fieldName,
true,
ctype == client.PN_COUNTER,
), nil
case client.FieldKind_NILLABLE_FLOAT:
return NewMerkleCounter[float64](
store,
schemaVersionKey,
key,
fieldName,
true,
), nil
}
case client.P_COUNTER:
switch kind {
case client.FieldKind_NILLABLE_INT:
return NewMerkleCounter[int64](
store,
schemaVersionKey,
key,
fieldName,
false,
), nil
case client.FieldKind_NILLABLE_FLOAT:
return NewMerkleCounter[float64](
store,
schemaVersionKey,
key,
fieldName,
false,
ctype == client.PN_COUNTER,
), nil
}
case client.COMPOSITE:
Expand Down

0 comments on commit c7a8713

Please sign in to comment.