Skip to content

Conversation

@jansigi
Copy link
Collaborator

@jansigi jansigi commented Sep 18, 2025

No description provided.

…ic code into module.

- Introduce QueryResolver interface (core): resolves a Resolvable AST with a DopeQueryManager into a backend-specific DopeQuery.
- Add new couchbase module with CouchbaseResolver implementing QueryResolver<CouchbaseDopeQuery>: serializes the AST to SQL++, formats clauses, expressions, range operations and aggregates parameters.
- Move Couchbase-specific code and tests into the couchbase module (including formatting utilities and FTS search handling); update imports/packages to reference the module.
- Wire up Gradle settings to include the couchbase module; keep existing public API unchanged.
@jansigi jansigi requested a review from pgruntz September 18, 2025 07:24
@jansigi jansigi self-assigned this Sep 18, 2025
@jansigi
Copy link
Collaborator Author

jansigi commented Nov 5, 2025

@codex review

fun build() = toDopeQuery(manager = DopeQueryManager())
fun <T : DopeQuery> build(resolver: QueryResolver<T>): T = toDopeQuery(DopeQueryManager(resolver))

@Deprecated("Use build(resolver) and pass a backend-specific resolver")
Copy link
Collaborator

Choose a reason for hiding this comment

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

That doesnt make sense: Either it is deprecated (= still usable) or it is removed.
Having a method, which just throws an exception doesnt make sense -> support it or remove it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,9 @@
package ch.ergon.dope.build
Copy link
Collaborator

Choose a reason for hiding this comment

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

irritating package name, name it ´resolver´

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

import ch.ergon.dope.resolvable.Resolvable

interface QueryResolver<T : DopeQuery> {
fun resolve(manager: DopeQueryManager<T>, resolvable: Resolvable): T
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not very understandable code: A QueryResolver has a method resolve, which takes a manager with another resolver as a field. So you could have a CouchbaseResolver and with resolve you pass a manager with another CouchbaseResolver? What does this mean? With do we need several?

Either you have a Resolver, which has a manager as a field or a Manager, which has a resolver as a field

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done, the Resolver has now the manager as a field

)
}

else -> TODO("Not yet implemented: $clause")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of throwing an NotImplementedException use a NotSupportedException

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do this for all TODO() in the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done, throws UnsupportedOperationException now

when (resolvable) {
is Clause -> ClauseResolver.resolve(manager, resolvable)

is RangeLike<*, *> -> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This File is super long. Can you make more specifi-resolvers (like the ClauseResolver)? E.g. ExpressionResolver, BucketResolver? And then if it still too big, do operatorResolver, typeResolver, ... (Analog to the packages in core) - I move the resolvers in (sub-)packages

We shouldnt have query-strings in this file.

import ch.ergon.dope.resolvable.expression.type.DopeVariable
import ch.ergon.dope.validtype.ValidType

fun <T : ValidType> DopeVariable<T>.toLetDefinitionDopeQuery(manager: DopeQueryManager<CouchbaseDopeQuery>): CouchbaseDopeQuery {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are unused

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,582 @@
package ch.ergon.dope.couchbase
Copy link
Collaborator

Choose a reason for hiding this comment

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

As already commented above, this should be in another sub-package. And the file is too big -> Move it sub-resolvers

@jansigi
Copy link
Collaborator Author

jansigi commented Nov 18, 2025

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

3 participants