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

libsql connector #14

Closed
pi0 opened this issue May 19, 2023 · 2 comments · Fixed by #25
Closed

libsql connector #14

pi0 opened this issue May 19, 2023 · 2 comments · Fixed by #25

Comments

@pi0
Copy link
Member

pi0 commented May 19, 2023

https://github.com/libsql/libsql

@Hebilicious
Copy link
Member

Hebilicious commented Jul 3, 2023

Assuming we solve this unjs/nitro#1371
This is going to be an annoying export map to follow https://github.com/libsql/libsql-client-ts/blob/main/package.json

Because we need different versions for different environments ...

import { createClient } from "@libsql/client";

For environments that don't have a local filesystem, but support HTTP or WebSockets, including:
Browsers
CloudFlare Workers
Netlify Edge Functions

import { createClient } from "@libsql/client/web";

For environments that only support HTTP, including Vercel Edge Functions:

import { createClient } from "@libsql/client/http";

For Deno:

// replace [version] with the client version
import { createClient } from "https://esm.sh/@libsql/client@[version]/web";

Easiest to solve this would be to create different presets, but that isn't magical ...

@pi0
Copy link
Member Author

pi0 commented Jul 3, 2023

We shall expose drivers extending a base like db0/connectors/turso-http, etc. And db0/connectors/turso with subpath conditions for each platform. Once nitro adds such conditions per platform, usage will be easier, however since it is always not possible to apply conditions, db0 would probably be best to expose each via explicit name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants