Skip to content

Commit

Permalink
Add type switch to get record uniqness - #27
Browse files Browse the repository at this point in the history
  • Loading branch information
emi80 committed Nov 15, 2019
1 parent 03f5199 commit 1c596e4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions sam/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,23 @@ func (r *Record) IsUniq() bool {
if !hasNH {
return false
}
NHval := NH.Value().(uint8)
return NHval == 1
switch v := NH.Value().(type) {
case int8:
return v == 1
case uint8:
return v == 1
case int16:
return v == 1
case uint16:
return v == 1
case uint32:
return v == 1
case int32:
return v == 1
case float32:
return v == 1
}
return false
}

func (r *Record) IsSplit() bool {
Expand Down

0 comments on commit 1c596e4

Please sign in to comment.