Skip to content
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

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

haoxins
Copy link
Collaborator

@haoxins haoxins commented Jan 12, 2024

deps #305

What type of PR is this?

  • bug
  • feature
  • enhancement

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:

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (5554785) 63.37% compared to head (34024c5) 63.27%.
Report is 1 commits behind head on master.

Files Patch % Lines
result_set.go 0.00% 4 Missing ⚠️

❗ 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.
📢 Have feedback on the report? Share it here.

@haoxins haoxins marked this pull request as ready for review January 12, 2024 03:59
@haoxins
Copy link
Collaborator Author

haoxins commented Jan 12, 2024

cc @Nicole00

wey-gu
wey-gu previously approved these changes Jan 19, 2024
Copy link
Contributor

@wey-gu wey-gu left a 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()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loved this!

@haoxins haoxins dismissed wey-gu’s stale review January 22, 2024 03:35

The merge-base changed after approval.

case reflect.Int64:
val.Field(fIdx).SetInt(rowVal.GetIVal())
case reflect.Float64:
val.Field(fIdx).SetFloat(rowVal.GetFVal())
Copy link
Contributor

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/?

Copy link
Collaborator Author

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.

@haoxins
Copy link
Collaborator Author

haoxins commented Jan 22, 2024

BTW, the examples are also complex for the starters.
We can add the most simple usage in the Readme.
Most use cases don't need to construct the space and schema,
we can give an example for the query only (query an already exists space with the defined schema).

@wey-gu
Copy link
Contributor

wey-gu commented Jan 22, 2024

BTW, the examples are also complex for the starters. We can add the most simple usage in the Readme. Most use cases don't need to construct the space and schema, we can give an example for the query only (query an already exists space with the defined schema).

Thanks so much @haoxins , you are making NebulaGraph/ NebulaGraph community a lot better 🫡.

@Nicole00 Nicole00 merged commit 68ea9f8 into vesoft-inc:master Jan 23, 2024
20 checks passed
@haoxins haoxins deleted the add-example branch January 23, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants