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

Add compat package that register driver as sqlite3 #150

Merged
merged 1 commit into from
Dec 26, 2023
Merged

Add compat package that register driver as sqlite3 #150

merged 1 commit into from
Dec 26, 2023

Conversation

Fabianexe
Copy link
Contributor

As discussed in #88 external libraries like ent use the sqlite3 as sqlite driver. Thus, it is necessary that the driver is registered under sqlite3.

This PR adds a compat package that makes it possible to Register it as sqlite3 with a simple import

import _ "github.com/glebarez/go-sqlite/compat"

One basic problem is that the global driver is not exported, and the RegisterDeterministicScalarFunction acts on the global driver. Thus, some exported function that makes it possible to Register the global driver externally is needed.

I solved this problem by a simple RegisterAsSQLITE3 method. Thus, I believe there is little impact on the API definition.
The only other way I am aware of to resolve this would be an internal package that contains the global driver and is imported on both points. However, this needs a larger refactor. Thus, I go with the simpler solution here.

@glebarez glebarez merged commit 74f6648 into glebarez:master Dec 26, 2023
9 checks passed
@glebarez
Copy link
Owner

Thanks for the contribution.
New tag will be pushed soon

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