Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica
Skip to main content

Module url

Module url 

Source
Expand description

Parser for eidetica connection URLs.

Eidetica has one connection-string entry point that dispatches across all supported backends and the daemon socket:

  • sqlite://./app.db — embedded eidetica with the sqlite backend; URL is handed through to sqlx::sqlite unchanged after the scheme check, so any sqlx-accepted form works (relative path, ?mode=rwc&journal_mode=WAL, etc.).
  • postgres://user:pwd@host/db — embedded eidetica with the postgres backend; URL is handed through to sqlx::postgres unchanged.
  • unix:///absolute/socket/path — thin client to a running eidetica daemon. Path must be absolute; query strings and fragments are rejected.
  • memory:// — ephemeral in-process backend.
  • memory:///absolute/path/snapshot.json — in-process backend with a JSON snapshot file (load-on-start, snapshot on Instance::flush / best-effort on Drop).

Schemes are matched case-insensitively per RFC 3986 (SQLITE://, Sqlite://, and sqlite:// are all accepted). The scheme portion of the URL passed through to sqlx is normalised to lowercase so backends that demand a lowercase scheme don’t reject it.

sqlite: and postgres:/postgresql: also accept the single-colon URI form (sqlite:file::memory:?cache=shared, sqlite:./app.db) that sqlx natively understands. This is required for sqlx’s in-memory URLs: the :// variant triggers URL authority parsing in sqlx and rejects :memory: as a port number. unix: and memory: keep the strict :// requirement so their typo hints still fire on unix:/run/sock.

Schemes that aren’t recognised return InstanceError::UnsupportedScheme with a typo hint when possible (mysql:// → suggests postgres://). URLs missing the scheme:// separator return InstanceError::InvalidUrl with a hint guessing at sqlite://.