convert json.Number to int64 in janus connector
we had previously already done the same thing for "number", i.e. float64
properties. This issue was blocking batch-adding properties that would
contain props of either of the "number" or "int" types.
closes
@@ -147,6 +147,13 @@ func addPrimitivePropToQuery(q *gremlin.Query, propType schema.PropertyDataType,
q = q.Int64Property(janusPropertyName, int64(t))
case float64:
q = q.Int64Property(janusPropertyName, int64(t))
+ case json.Number:
+ asInt, err := t.Int64()
+ if err != nil {
+ return q, fmt.Errorf("Illegal json.Number value for property %s, could not be converted to int64: %s", sanitizedPropertyName, err)
+ }
+
+ q = q.Int64Property(janusPropertyName, asInt)
default:
return q, fmt.Errorf("Illegal primitive value for property %s, value is %#v", sanitizedPropertyName, t)
}
