Support USING SERVICE LEVEL in SelectBuilder#370
Open
zerojulian wants to merge 2 commits into
Open
Conversation
- Adds `USING SERVICE LEVEL` functionality to the `SelectBuilder` by adding a method to the `using` struct. ### Changes - Adds a `using.ServiceLevel(name string)` method to capture using a service level with the provided name. - Adds handling to `using.writeCql()` to generate the appropriate CQL. - Adds a `SelectBuilder.ServiceLevel(name string)` method to allow `SelectBuilder` objects to use the service level functionality. - Adds some test cases to `TestUsing` to affirm that the generated CQL matches expectations.
There was a problem hiding this comment.
Pull request overview
Adds support for USING SERVICE LEVEL to the query builder layer by extending the internal using clause writer and exposing a new SelectBuilder.ServiceLevel(...) API for SELECT statements.
Changes:
- Extend
qb.usingto store and emitUSING SERVICE LEVEL '<name>'(with single-quote escaping). - Add
SelectBuilder.ServiceLevel(name string)to opt into the clause from SELECT queries. - Add unit tests for
using.writeCql()to validate expected CQL output for service level cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| qb/using.go | Adds serviceLevel state, a ServiceLevel(...) setter, and CQL generation for USING SERVICE LEVEL. |
| qb/using_test.go | Adds test cases covering service level rendering and escaping behavior. |
| qb/select.go | Exposes SelectBuilder.ServiceLevel(...) to use the new using capability on SELECT queries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+178
to
+182
| // ServiceLevel adds a USING SERVICE LEVEL clause with the given name to the query | ||
| func (b *SelectBuilder) ServiceLevel(name string) *SelectBuilder { | ||
| b.using.ServiceLevel(name) | ||
| return b | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
USING SERVICE LEVELfunctionality to theSelectBuilderby adding a method to theusingstruct.Changes
using.ServiceLevel(name string)method to capture using a service level with the provided name.using.writeCql()to generate the appropriate CQL.SelectBuilder.ServiceLevel(name string)method to allowSelectBuilderobjects to use the service level functionality.TestUsingto affirm that the generated CQL matches expectations.