#macro-derive #repository

macro rustling-derive

Procedural macros for Rustling repositories (PostgreSQL and MongoDB)

1 unstable release

Uses new Rust 2024

0.1.0 Oct 19, 2025

#198 in #repository

MIT/Apache

44KB
447 lines

rustling-derive ⚙️

Procedural macros for automatic repository generation in the Rustling ORM ecosystem.

This crate provides convenient #[derive(...)] macros that automatically implement repository and entity patterns for MongoDB and PostgreSQL.

✨ Available Macros

  • #[derive(Repository)] — derive a PostgreSQL repository implementation
  • #[derive(MongoRepository)] — derive a MongoDB repository implementation
  • #[derive(Entity)] — derive helper methods for SQL entities (columns & values)

💡 Example

use rustling_derive::{Entity, Repository};

#[derive(Entity)]
struct User {
    id: i32,
    name: String,
    email: String,
}

#[derive(Repository)]
#[entity(User)]
#[id(i32)]
#[table("users")]
struct UserRepository;

See the crate README for setup instructions.


rustling-derive ⚙️

Procedural macros for generating repository implementations using the rustling-data runtime.


✨ Macros Overview

Macro Description
#[derive(Repository)] Generates CRUD repository for PostgreSQL
#[derive(MongoRepository)] Generates CRUD repository for MongoDB
#[derive(Entity)] Generates metadata accessors for entity structs

📦 Installation

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

Dependencies

~0.9–1.8MB
~36K SLoC