Documentation
¶
Overview ¶
Package dsn centralises DSN dialect detection, driver opening, and auth-token injection so the runtime engine and the migrate CLI share one implementation and cannot drift apart.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAuthToken ¶
ApplyAuthToken appends an authToken query parameter to a libSQL DSN when a token is supplied and the DSN does not already carry one. It is a no-op for an empty token or a DSN that already has authToken=.
func DetectDialect ¶
DetectDialect inspects the DSN and returns "libsql", "sqlite", or "postgres". SQLite is recognised by the "file:"/"sqlite://" prefix, ":memory:", a ".db"/".sqlite"/".sqlite3" suffix, or — conservatively — a schemeless DSN that looks like a filesystem path rather than a Postgres host/host:port/keyword DSN. "postgres://"/"postgresql://", host:port, user@host and "key=value" DSNs map to "postgres". Use WithDialect/WithDriver to override detection.
- "libsql": libsql:// wss:// ws:// http:// https:// (Turso / local sqld).
- "sqlite": file: prefix, sqlite:// prefix, ":memory:", a path ending in ".db"/".sqlite"/".sqlite3", or a schemeless path that is not a Postgres target.
- "postgres": postgres://, postgresql://, host:port, user@host, or libpq key=value.
Types ¶
This section is empty.