Skip to content

Commit

Permalink
Tolerate int32 value in database when reading into an int64
Browse files Browse the repository at this point in the history
This use case discovered in reading a hierarchy node
  • Loading branch information
peterhoward42 committed Jul 18, 2019
1 parent 324718b commit c13ceac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ func (v Vertex) GetMultiPropertyAs(key, wantType string) (vals []interface{}, er
}
vals = append(vals, int32(val))
case "int64":
var typeIf, valIf interface{}
if typeIf, ok = prop.Value.Value.(map[string]interface{})["@type"]; !ok || typeIf != "g:Int64" {
typedPropValue := prop.Value.Value.(map[string]interface{})
typeAsString, ok := typedPropValue["@type"]
if !ok || (typeAsString != "g:Int64" && typeAsString != "g:Int32") {
return vals, ErrorUnexpectedPropertyType
}
var valIf interface{}
if valIf, ok = prop.Value.Value.(map[string]interface{})["@value"]; !ok {
return vals, ErrorUnexpectedPropertyType
}
Expand Down

0 comments on commit c13ceac

Please sign in to comment.