tideorm 0.3.0

A developer-friendly ORM for Rust with clean, expressive syntax
Documentation

TideORM 🌊

A developer-friendly ORM for Rust with clean, expressive syntax.

Website Rust License

✨ Features

  • 🎯 Clean Model Definitions - Simple #[derive(Model)] macro
  • ⚡ Async-First - Built for modern async/await workflows
  • 🔄 Auto Schema Sync - Automatic table management during development
  • 🛡️ Type Safe - Full Rust type safety with zero compromises
  • 🗃️ Multi-Database - PostgreSQL, MySQL, and SQLite support
  • 📦 Batteries Included:
    • Fluent Query Builder with Window Functions & CTEs
    • Database Migrations & Seeding
    • Model Validation System
    • Translations (i18n) for multilingual content
    • File Attachments with metadata
    • Full-Text Search with highlighting
    • Soft Deletes & Callbacks
    • Transaction Support

🚀 Quick Start

use tideorm::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Model, Clone, Debug, Serialize, Deserialize)]
#[tide(table = "users")]
pub struct User {
    #[tide(primary_key, auto_increment)]
    pub id: i64,
    pub email: String,
    pub name: String,
    pub active: bool,
}

#[tokio::main]
async fn main() -> tideorm::Result<()> {
    // Connect with auto schema sync (development only!)
    TideConfig::init()
        .database("postgres://localhost/mydb")
        .sync(true)
        .connect()
        .await?;

    // Create
    let user = User {
        id: 0,
        email: "john@example.com".into(),
        name: "John Doe".into(),
        active: true,
    };
    let user = user.save().await?;

    // Query
    let users = User::query()
        .where_eq("active", true)
        .order_desc("created_at")
        .limit(10)
        .get()
        .await?;

    // Update
    let mut user = User::find(1).await?.unwrap();
    user.name = "Jane Doe".into();
    user.update().await?;

    // Delete
    User::destroy(1).await?;

    Ok(())
}

📦 Installation

[dependencies]
# PostgreSQL (default)
tideorm = { version = "0.3", features = ["postgres"] }

# MySQL
tideorm = { version = "0.3", features = ["mysql"] }

# SQLite
tideorm = { version = "0.3", features = ["sqlite"] }

Feature Flags

Feature Description
postgres PostgreSQL support (default)
mysql MySQL/MariaDB support
sqlite SQLite support
runtime-tokio Tokio runtime (default)
runtime-async-std async-std runtime

📖 Documentation

For detailed documentation on all features, see DOCUMENTATION.md.

Key sections:

📚 Examples & Testing

Run an example:

cargo run --example basic --features postgres

Run tests:

cargo test --features postgres

See the examples directory and DOCUMENTATION.md for more.

Rusty Rails Project

TideORM is part of the larger Rusty Rails project, which aims to bridge the gap between Rust and Ruby/Ruby on Rails ecosystems. We're actively working on recreating Ruby libraries in Rust to make working with Rust more easy and fun for new developers.

Related Projects

  • 🔗 More Rust libraries coming soon!

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with ❤️ by the Rusty Rails team