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

feat: support disable dialect's feature #1070

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

j2gg0s
Copy link
Collaborator

@j2gg0s j2gg0s commented Nov 21, 2024

Issue: #1045

@vmihailenco
Copy link
Member

vmihailenco commented Nov 21, 2024

I'd say this should be done one the dialect level, e.g.:

myDialect := pgdialect.New(pgdialect.WithoutFeature(...))

And then the db will just use the features from the dialect:

db := bun.NewDB(sqldb, myDialect)

@j2gg0s
Copy link
Collaborator Author

j2gg0s commented Nov 21, 2024

@vmihailenco

Can we support both levels? Dialect and DB
I don’t think we should assume which level the user should use.

@j2gg0s
Copy link
Collaborator Author

j2gg0s commented Nov 21, 2024

@vmihailenco

Can we support both levels? Dialect and DB I don’t think we should assume which level the user should use.

And i dont want to add method for every dialect.

@j2gg0s j2gg0s requested a review from vmihailenco November 21, 2024 10:15
@vmihailenco
Copy link
Member

The problem with your current approach is that now we have bun.DB with one set of features and dialect with another set features. It might be that we currently don't use dialect.features anywhere, but it will probably create a problem in the long term.

And i dont want to add method for every dialect.

We can try to create BaseDialect and extract this functionality to the dialect package, but TBH it looks easier to just copy/paste 2 simple methods in each package.

@j2gg0s j2gg0s force-pushed the feat-support-disable-dialect-feature branch 2 times, most recently from 83af1ef to 742587b Compare November 22, 2024 03:26
@j2gg0s
Copy link
Collaborator Author

j2gg0s commented Nov 22, 2024

@vmihailenco

Let use remove DB.features, and use only the dialect?

@j2gg0s j2gg0s force-pushed the feat-support-disable-dialect-feature branch from 742587b to d73b0b9 Compare November 22, 2024 03:44
@vmihailenco
Copy link
Member

vmihailenco commented Nov 22, 2024

Looks good 👍

I still think that options should be named WithFeature and WithoutFeature, not AddFeature and RemoveFeature, but no biggie.

At the same time, we have also consolidated the logic
for determining features in the database into the dialect.
@j2gg0s j2gg0s force-pushed the feat-support-disable-dialect-feature branch from d73b0b9 to 5343bd7 Compare November 25, 2024 02:18
@j2gg0s j2gg0s merged commit 89e9d51 into uptrace:master Nov 25, 2024
4 checks passed
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