libsql-orm-macros 0.1.1

Procedural macros for libsql-orm - automatic Model trait implementation and ORM functionality
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
rust
F#rustc 1.88.0 (6b00bc388 2025-06-23)�
orm_column�derive_model�generate_migration���j�$! Procedural macros for libsql-orm�$% ��*VS This crate provides derive macros and attribute macros for the libsql-orm library,���UR enabling automatic implementation of ORM traits and convenient model definitions.�$���� # Derive Macros�$���� ## `#[derive(Model)]`�$����ZW Automatically implements the `Model` trait for a struct, providing all CRUD operations��� and ORM functionality.�$��\� ```rust�ԛ use libsql_orm::Model;���(% use serde::{Serialize, Deserialize};�$����,) #[derive(Model, Serialize, Deserialize)]��� struct User {��     pub id: Option<i64>,���     pub name: String,���     pub email: String,�,� }�<� ```�$���� # Attribute Macros�$����%" ## `#[table_name("custom_name")]`�$����VS Specifies a custom table name for the model. By default, the table name is derived���0- from the struct name converted to lowercase.�$��\�������(�$����,���! #[table_name("custom_users")]������̯�,��<��$���� ## `#[orm_column(...)]`�$����;8 Specifies custom column properties for database fields.�$�	�\�	���	���	(�$�
���
,���
���
A>     #[orm_column(type = "INTEGER PRIMARY KEY AUTOINCREMENT")]���D�     ���'$     #[orm_column(not_null, unique)]����D����52     #[orm_column(type = "TEXT DEFAULT 'active'")]�ܼ     pub status: String,�,��<��$���� # Function-like Macros�$�
���
#  ## `generate_migration!(Model)`�$�
���
;8 Generates a database migration from a model definition.�$�
�\�
���;8 use libsql_orm::{generate_migration, MigrationManager};�$����.+ let migration = generate_migration!(User);���,) let manager = MigrationManager::new(db);���1. manager.execute_migration(&migration).await?;�<����=: Column attribute macro for defining SQL column properties�$����XU This attribute allows you to specify custom SQL column properties for struct fields.�$��܀ # Supported attributes:���63 - `type = "SQL_TYPE"` - Custom SQL type definition���*' - `not_null` - Add NOT NULL constraint���(% - `unique` - Add UNIQUE constraint  ���)& - `primary_key` - Mark as PRIMARY KEY���DA - `auto_increment` - Add AUTOINCREMENT (for INTEGER PRIMARY KEY)�$��|� # Examples:�$��\���� #[derive(Model)]������A���D����'�
���D����5�
���,��<��<��H��$! Derive macro for the Model trait�$����VS Automatically implements the `Model` trait for a struct, providing CRUD operations���WT and ORM functionality. The macro analyzes the struct fields to generate appropriate���&# SQL schema and conversion methods.�$���� # Attributes:���@= - `#[table_name("custom_name")]` - Specify custom table name���85 - `#[orm_column(...)]` - Configure column properties�$��|��$��\��Ԋ���(�$����,�Ԁ #[table_name("users")]������������,��<��Model���6��b,) Macro to generate migration from a model�$�b���bPM Creates a migration instance from a model's schema definition. The migration���cEB will contain the SQL necessary to create the table for the model.�$�d�|�d�$�d�\�d���d;�$�d���d(% // Generate migration for User model���e30 let user_migration = generate_migration!(User);�$�e���e // Execute the migration���e,���f63 manager.execute_migration(&user_migration).await?;�<�f�`��f<P9H�R;�|q�y���*=�����]��1��M	��*+)	���z������u5�u����ODHT @���!,l��	�Z~�y���oE���
��Td�8&���������}������-DcPM�n�6B�"��P9H�R;����Ф�����6Q#��	F�7I��$�[�94܂�� ��5��]�^�����1f�$ZJ��^c��1%
���������İ�*@-o*=�����]�D�y�v\$~?0I8��}����*��1��|q�y����e*�s���8�;��暲=���
i[�O��~�o������7vwggn������A�/����1KQ��7.�;��}x������~
F�e��i[�O��~�o������l/Users/ayonsaha/Work/Ayon-Saha-2/Freelancer Portal - kaj24.com/kaj24/libsql-orm/libsql-orm-macros/src/lib.rs� �y�����N3�[>\���j�%WV[)-&W1)-"<)-B	(	6$<</-2V>Y7+)*EB	(	6K0<
%WX'A9)-@9:96=V;V6..
)/I2AA.
'

U.
7
5$
0(
4+>B(,
k 8oC$*LU::>A;%GTlm-
q ;$/LUq8O=%IT8�4FH
	C 2H#C6(#L3@@==A@9
1'0(&$),
+40679A;%9#>(A+
UD FA?+
!.?0812
	-QF<)4-7?9
/<C
 H3/#��z�U$�7��i�aarch64-apple-darwin������rW��*�<��Xlibsql_orm_macros�-31a2e72157f30ea1��(�V����/� �B,,,,!�rust-end-file