#mongo-db #postgresql #repository

rustling-data

Core data access layer for Rustling, supporting PostgreSQL and MongoDB

1 unstable release

Uses new Rust 2024

0.1.0 Oct 19, 2025

#91 in #mongo-db


Used in rustling-derive

MIT/Apache

31KB
268 lines

rustling-data 🦀

Core runtime layer for the Rustling ORM system. Provides traits, error types, and database drivers used by the derive macros in rustling-derive.

Features

  • mongo: MongoDB driver
  • postgres: PostgreSQL driver

Example

use rustling_data::api::CrudRepository;
use rustling_derive::MongoRepository;

See the crate README for complete examples.


rustling-data 🦀

rustling-data provides the runtime layer for Rustling ORM-style repositories — including database drivers, generic repository traits, and shared error handling.

It is designed to be used together with rustling-derive, which provides #[derive(...)] macros that automatically generate repository implementations for MongoDB and PostgreSQL.


✨ Features

  • 🧩 Unified repository trait — define CRUD logic once, backend-agnostic.
  • 🗃️ MongoDB driver (optional via --features mongo)
  • 🐘 PostgreSQL driver (optional via --features postgres)
  • 🎯 Custom RepositoryError for consistent error handling.
  • ⚙️ Fully async with tokio + async-trait.

🧱 Installation

Add to your Cargo.toml:

[dependencies]
rustling-data = { version = "0.1", features = ["mongo"] }      # or ["postgres"]
rustling-derive = "0.1"

Dependencies

~0.9–17MB
~152K SLoC