Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Lithair learns SQL — and lists everything it refuses to promise

Описание и применение

Lithair добавил экспериментальную поддержку SQL‑хранилища Turso, сохраняя при этом гарантии памяти‑первого подхода. Каждый модель может использовать только один источник данных, а не поддерживаемые функции генерируют ошибки компиляции или отказ в запуске. Последние релизы исправили миграции, пагинацию и критическую ошибку воспроизведения событий.

Задача

Adding SQL storage to a memory‑first framework without breaking its guarantees and without introducing hidden promises.

Результат

Lithair successfully integrates SQL storage on a per‑model basis while preserving its memory‑first guarantees. Unsupported features are caught at compile time, and the framework refuses to start in configurations that could lead to data loss. Recent releases addressed migrations, pagination, parity, and a critical replay bug.

Рабочий процесс

  • 1. Add lithair-turso crate to Cargo.toml.
  • 2. Annotate a model with #[storage(turso)] and declare primary key and validations.
  • 3. Register the model with LithairServer::new().with_model::<Archive>("./data/archives", "/api/archives").
  • 4. On startup, Lithair opens the Turso database and generates CRUD routes.
  • 5. The framework rejects any SQL model that requests unsupported features (e.g., foreign keys, SSE, Raft).
  • 6. If the server contains both native and SQL models, it refuses to start to avoid incomplete backups.
  • 7. Use the provided migration syntax (version = 2, migrations(note_v2)) to evolve schemas.
  • 8. Pagination now returns has_more and next_offset for SQL lists.
  • 9. Ensure DELETE responses match native semantics or adjust client parsing.

Доказательства

Lithair does not depend on the Turso driver. A native application doesn’t compile it, doesn’t download it, doesn’t know it exists.

Источник

The framework doesn’t pretend to do that for you.

Источник

The same day, an application built on Lithair reported this: create a record, delete it, restart the server — and the GET on the deleted ID answers 200.

Источник

  • Дата записи: 2026-09-22T04:00:40.248Z