Skip to content

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
@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