-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add example code for using ResultSet Scan #303
Conversation
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #303 +/- ##
==========================================
- Coverage 63.37% 63.27% -0.11%
==========================================
Files 9 9
Lines 2452 2456 +4
==========================================
Hits 1554 1554
- Misses 768 772 +4
Partials 130 130 ☔ View full report in Codecov by Sentry. |
cc @Nicole00 |
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.
Thanks!
result_set.go
Outdated
@@ -336,31 +336,35 @@ func (res ResultSet) Scan(v interface{}) error { | |||
|
|||
// Scan scans the rows into the given value. | |||
func (res ResultSet) scanRow(row *nebula.Row, colNames []string, t reflect.Type) (reflect.Value, error) { | |||
rowValues := row.GetValues() | |||
rowVals := row.GetValues() | |||
|
|||
val := reflect.New(t).Elem() | |||
|
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.
loved this!
The merge-base changed after approval.
case reflect.Int64: | ||
val.Field(fIdx).SetInt(rowVal.GetIVal()) | ||
case reflect.Float64: | ||
val.Field(fIdx).SetFloat(rowVal.GetFVal()) |
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.
don't we need to process bool/float32/int8/int16/date/datetime/time/duration/?
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.
we need, but I will open another PR to do this.
Also we need enhance/refactor the tests.
this is just make the example works.
BTW, the examples are also complex for the starters. |
Thanks so much @haoxins , you are making NebulaGraph/ NebulaGraph community a lot better 🫡. |
deps #305
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
How do you solve it?
Special notes for your reviewer, ex. impact of this fix, design document, etc: