Skip to content

Commit 1c0edcc

Browse files
authored
Merge pull request #4 from beyondnetworks/write-int-properties-as-long
Write int properties as long
2 parents 422411a + cccab43 commit 1c0edcc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

query/traversal/addproperty.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020

2121
package traversal
2222

23+
import (
24+
"fmt"
25+
)
26+
2327
// http://tinkerpop.apache.org/docs/current/reference/#addproperty-step
2428

2529
// Property (sideEffect) unlike AddV() and AddE(), Property() is
@@ -36,6 +40,15 @@ func (g String) Property(objOrCard interface{}, obj interface{}, params ...inter
3640
fullParams = append(fullParams, objOrCard, obj)
3741
fullParams = append(fullParams, params...)
3842

43+
for i, p := range fullParams {
44+
switch t := p.(type) {
45+
// Write every numeric property as long - to prevent indexing issues
46+
case int, int16, int32, int64, uint, uint16, uint32, uint64:
47+
// Convert to byte, so that "" won't be added
48+
fullParams[i] = []byte(fmt.Sprintf("%vl", t))
49+
}
50+
}
51+
3952
g.AddStep("property", fullParams...)
4053

4154
return g

0 commit comments

Comments
 (0)