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

Usage with TursoDB #208

Open
m00nreal opened this issue May 11, 2024 · 1 comment
Open

Usage with TursoDB #208

m00nreal opened this issue May 11, 2024 · 1 comment

Comments

@m00nreal
Copy link

Turso

Turso is a DBaaS based on libsql. They provide their own sdk kit for Go.

Issue

When I tried using sqlite3store I kept getting errors due the insert syntax.
This can be reproduced with the example from sqlite3store.go.

2024/05/11 05:30:24 failed to execute SQL: SELECT data FROM sessions WHERE token = $1 AND julianday('now') < expiry Arguments do not match SQL parameters: value for parameter $1 not found

Note that this is only happening when I create an instance of sqlite3store passing a db connection created with the import of turso sdk (_ "github.com/tursodatabase/libsql-client-go/libsql") then assigning it to sessionManager.store.

So after an embarrasing amount of hours, I was able finally to debug what's going on (I'm on my joruney of learning Go).
I went ahead an copied inside my own files a copy of sqlite3store.go and modified every named placeholder for positional placeholders and suddenly everything works as expected on Turso.

So I guess my question is, is there any risk on creating a PR to change $<number> for ?'s for sqlite3store.go?
After this changes, I can connect and work just fine using either a turso or local database. However that's as far as I tested.

Another option would be maybe create a PR with a new session store for Turso exclusively, but given the changes needed are small maybe it's just better to keep one store.

In any case, for the time being I'll just use my modified version.

@m1yon
Copy link

m1yon commented Jun 26, 2024

Thanks for this. I was running into the same problem, and your solution worked. Looks like there's a PR already open for this actually #193

It'd be great if we could get this merged @alexedwards 🙏

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

No branches or pull requests

2 participants