#model #mongo-db #macro #mango

macro metamorphose

Macros collection for converting Structure to Model, for a green-barrel project

12 stable releases

1.4.1 Aug 15, 2023
1.3.4-beta Dec 15, 2022
1.3.1 May 5, 2023
1.2.1-beta Nov 27, 2022
0.2.2-alpha.2 Nov 21, 2020

#861 in Procedural macros

Download history 1/week @ 2024-02-20 55/week @ 2024-02-27

56 downloads per month
Used in mango-panel

MIT/Apache

41KB
523 lines

Logo

Metamorphose

Macros collection for converting Structure to Model, for a Green Barrel project.

crates.io crates.io Metamorphose on docs.rs crates.io crates.io

Macros

Model

Macro for converting Structure to green-barrel Model. The model can access the database. The model can create, update, and delete documents in collections.

Requirements

Usage

Follow the Green Barrel link.

Model parameters

( all parameters are optional )

Parameter: Default: Description:
db_query_docs_limit 1000 limiting query results.
is_add_doc true Create documents in the database. false - Alternatively, use it to validate data from web forms.
is_up_doc true Update documents in the database.
is_del_doc true Delete documents from the database.
ignore_fields empty string Fields that are not included in the database (separated by commas).
is_use_addition false Allows methods for additional actions and additional validation.
is_use_hooks false Allows hooks methods - impl Hooks for ModelName.

Changelog

  • v1.4.0 Renamed field names - Added Field word.
  • v1.1.0 Removed 12 types of fields, the remaining fields have been renamed. See the documentation - https://docs.rs/green-barrel/latest/green_barrel/fields/index.html
  • v1.3.2-beta Fixed basic example and updated readme file.
  • v1.3.0-beta Transition to asynchronous code.
  • v1.2.0-beta Updated dependency mongodb to version 2.
  • v1.1.9-beta Updated README.md file.
  • v1.1.0-beta Added support for Fixtures - To populate the database with pre-created data.
  • v1.0.0-beta Not compatible with green-barrel v0.x.x and metamorphose v0.x.x
  • v0.7.12 Fixed README.md.
  • v0.7.8 Fixed validation for multi-select fields.
  • v0.7.0 Added trait Administrator for easier registration of Models in the administration panel.
  • v0.6.10 Added the ability to customize html code for web forms. See documentation: mango_orm > widgets > generate_html_code > GenerateHtmlCode > generate_html().
  • v0.6.9 Rename trait ToModel to Main.
  • v0.6.0 The created_at and updated_at fields are automatically added to the Model. The widget type is inputDateTime and disabled = true, is_hide = true. Updated README.md. Updated documentation.
  • v0.5.4 Fixed ModelName::key() method. See documentation: mango_orm > models > ToModel.
  • v0.5.2 Import optimized.
  • v0.5.0 Added model attribute is_use_hooks. See documentation: mango_orm > models > hooks > Hooks.
  • v0.4.8 Fixed error message text.
  • v0.4.6 Updating by version of dependencies.
  • v0.4.4 Optimization of the validation mechanism.
  • v0.4.3 Improved validation for Slug fields.
  • v0.4.2 Removed hiddenSlug field.
  • v0.4.1 Added is_hide parameter for Widgets.
  • v0.4 Added inputSlug and hiddenSlug fields.
  • v0.3 Removed the Form macro.

License

This project is licensed under the MIT and Apache Version 2.0

Dependencies

~29–43MB
~835K SLoC