-
Notifications
You must be signed in to change notification settings - Fork 150
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
feat: Add support to convert a Query to a BundledQuery. #1034
Conversation
Codecov Report
@@ Coverage Diff @@
## wuandy/Bundles #1034 +/- ##
==================================================
- Coverage 97.46% 97.45% -0.01%
==================================================
Files 25 25
Lines 16015 16044 +29
Branches 1218 1217 -1
==================================================
+ Hits 15609 15636 +27
- Misses 403 405 +2
Partials 3 3
Continue to review full report at Codecov.
|
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.
This LGTM, minus some nits. Thanks!
dev/src/reference.ts
Outdated
structuredQuery, | ||
}; | ||
|
||
reqOpts.transaction = transactionId; |
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.
Nit: Merge this into the assignment above.
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.
Done.
dev/src/reference.ts
Outdated
|
||
reqOpts.transaction = transactionId; | ||
|
||
return reqOpts; |
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.
Possible inline?
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.
Done.
dev/src/reference.ts
Outdated
|
||
/** | ||
* Internal method for serializing a query to its RunQuery proto | ||
* representation with an optional transaction id. |
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.
This documentation seems not applicable.
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.
Fixed.
}, | ||
], | ||
}; | ||
if (this._queryOptions.allDescendants) { |
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.
Nit: Empty line above
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.
Done.
o.toProto() | ||
); | ||
} | ||
structuredQuery.startAt = this.toCursor(this._queryOptions.startAt); |
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.
Nit: Empty line above
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.
Done.
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!
* Update from googleapis.git * Add bundle.proto. * Move bundle.proto to a different folder. * Add support to convert a Query to a BundledQuery. * Move the proto file again * Move the proto file again * Update package name. * Update to use new package name.
* Update from googleapis.git * Add bundle.proto. * Move bundle.proto to a different folder. * Add support to convert a Query to a BundledQuery. * Move the proto file again * Move the proto file again * Update package name. * Update to use new package name.
* Update from googleapis.git * Add bundle.proto. * Move bundle.proto to a different folder. * Add support to convert a Query to a BundledQuery. * Move the proto file again * Move the proto file again * Update package name. * Update to use new package name.
Note the tricky thing here is: we introduced limitToLast, which means we need to decide if the
structuredQuery
saved in the bundle should be translated or not.This implementation saves it without translation, which means the client SDK will use the
structureQuery
andlimitType
saved here to construct a new clientQuery
, and leaves the translation to the existing logic on the client side.