Skip to content

Support USING SERVICE LEVEL in SelectBuilder#370

Open
zerojulian wants to merge 2 commits into
scylladb:masterfrom
zeroflucs-given:master
Open

Support USING SERVICE LEVEL in SelectBuilder#370
zerojulian wants to merge 2 commits into
scylladb:masterfrom
zeroflucs-given:master

Conversation

@zerojulian
Copy link
Copy Markdown

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.

- 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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.using to store and emit USING 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 thread qb/select.go
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
}
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

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.

2 participants