Module database

Module database 

Source
Expand description

§Database Storage Implementation with Toasty

Persistent storage backend using Toasty ORM for database operations.

§⚠️ EXPERIMENTAL - NOT PRODUCTION READY

Current Status: This implementation uses in-memory storage as a fallback.

Why: Toasty ORM (v0.1.1) is in early incubation stage:

  • Not production-ready (as stated by Tokio team)
  • API is unstable and may change
  • Limited documentation
  • Schema definition requires procedural macros (#[toasty::model])
  • Proper integration requires:
    1. Adding toasty dependency with derive feature
    2. Defining models with #[derive(Model)] and #[toasty::model]
    3. Setting up database connections with proper error handling
    4. Implementing migrations

Recommendation: For production use, consider:

  • Use InMemoryStorage for development/testing
  • Use mature ORMs like sqlx or diesel for production
  • Wait for Toasty to reach stable release (v1.0+)

Future: Once Toasty matures, this implementation will be updated with:

  • Proper model definitions using #[toasty::model]
  • Full CRUD operations
  • Database migrations
  • Multi-database support (PostgreSQL, MySQL, SQLite, DynamoDB)

§Current Implementation

Currently uses InMemoryStorage as a fallback to provide a working interface. All data is stored in memory and will be lost on restart.

Structs§

DatabaseStorageNon-database