bottle-orm-macro

Crates.iobottle-orm-macro
lib.rsbottle-orm-macro
version0.4.3
created_at2026-01-18 20:20:32.211142+00
updated_at2026-01-24 00:09:54.672175+00
descriptionProcedural macros for bottle-orm, a lightweight ORM for Rust
homepage
repositoryhttps://github.com/Murilinho145SG/bottle-orm
max_upload_size
id2053019
size45,128
Murillo Deolino (Murilinho145SG)

documentation

README

Bottle ORM Macro

Crates.io Docs.rs License

This crate provides the procedural macros for Bottle ORM, specifically the #[derive(Model)] macro. It is used to automatically generate schema definitions and SQL mapping for your Rust structs.

Note: This crate is intended to be used as a dependency of bottle-orm, not standalone. Please refer to the main bottle-orm documentation for usage instructions.

Installation

You should install the main crate:

[dependencies]
bottle-orm = "0.1.0"

However, if you need to inspect this macro crate specifically:

[dependencies]
bottle-orm-macro = "0.1.0"

Supported Attributes

You can use the #[orm(...)] attribute on struct fields to configure database constraints and types.

Attribute Description Example
primary_key Marks the column as the Primary Key. #[orm(primary_key)]
unique Adds a UNIQUE constraint to the column. #[orm(unique)]
index Creates a database index for this column. #[orm(index)]
create_time Sets the default value to the current timestamp (NOW()/CURRENT_TIMESTAMP). #[orm(create_time)]
size = N Sets the column size (e.g., VARCHAR(N)). Defaults to TEXT if omitted. #[orm(size = 255)]
foreign_key = "Table::Column" Defines a Foreign Key relationship. #[orm(foreign_key = "User::id")]

License

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

Commit count: 45

cargo fmt