-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for string array #22
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22 +/- ##
==========================================
+ Coverage 71.39% 71.63% +0.23%
==========================================
Files 7 7
Lines 486 483 -3
==========================================
- Hits 347 346 -1
+ Misses 125 124 -1
+ Partials 14 13 -1
Continue to review full report at Codecov.
|
utils.go
Outdated
@@ -3,18 +3,17 @@ package redisgraph | |||
import ( | |||
"crypto/rand" | |||
"fmt" | |||
"reflect" | |||
"strings" | |||
) | |||
|
|||
// go array to string is [1 2 3] for [1, 2, 3] array | |||
// cypher expects comma separated array | |||
func arrayToString(arr interface{}) interface{} { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be
func arrayToString(arr []interface{}) interface{} {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
utils.go
Outdated
|
||
switch i.(type) { | ||
case string: | ||
s := i.(string) | ||
if len(s) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we wrap s in " s "
regardless if s is: "..."
e.g. s value contains "
utils.go
Outdated
strArray := []string{} | ||
for i := 0; i < arrayLength; i++ { | ||
strArray = append(strArray, fmt.Sprintf("%v", ToString(v.Index(i)))) | ||
strArray = append(strArray, fmt.Sprintf("%v", ToString(v[i]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what we want here is to wrap v[i]
in quotes if v[i]
is of type string,
if this is indeed the case, use a different function, e.g. QuoteString(v[i])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ToString
method does it
11fc22a
to
20246a5
Compare
20246a5
to
d1279e7
Compare
No description provided.