green-barrel

Crates.iogreen-barrel
lib.rsgreen-barrel
version1.7.8
sourcesrc
created_at2022-08-03 10:19:10.801401
updated_at2023-09-07 16:06:36.633755
descriptionORM-like API MongoDB for Rust.
homepagehttps://github.com/kebasyaty/green-barrel
repositoryhttps://github.com/kebasyaty/green-barrel
max_upload_size
id637959
size445,586
(AurelienFT)

documentation

README

Logo

Green Barrel

ORM-like API MongoDB for Rust

For simulate relationship Many-to-One and Many-to-Many, a simplified alternative (Types of selective fields with dynamic addition of elements) is used.

crates.io crates.io Green Barrel on docs.rs crates.io crates.io

Attention

MongoDB tested on versions 4.2, 4.4, 5.0, 6.0

  • Support for GreenPanel is temporarily unavailable.

Requirements

Install mongodb (if not installed)

Follow the link Install MongoDB.

Usage:

Basic Example

Tests for examples

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.

Links to Documentation

Field types

See documentation -fields.

Methods for Developers

Main

  • hash()
  • set_hash()
  • obj_id()
  • set_obj_id()
  • created_at()
  • updated_at()

Caching

  • meta()
  • new()
  • json()
  • update_dyn_field()

Control

  • custom()

Addition

  • add_actions()
  • add_validation()

Hooks

  • pre_create()
  • post_create()
  • pre_update()
  • post_update()
  • pre_delete()
  • post_delete()

QCommons

  • create_index()
  • drop_index()
  • create_indexes()
  • drop_indexes()
  • aggregate()
  • count_documents()
  • delete_many()
  • delete_one()
  • distinct()
  • drop()
  • estimated_document_count()
  • find_many_to_doc_list()
  • find_many_to_json()
  • find_one_to_doc()
  • find_one_to_json()
  • find_one_to_instance()
  • find_one_and_delete()
  • collection_name()
  • namespace()

QPaladins

  • check()
  • save()
  • delete()
  • create_password_hash()
  • verify_password()
  • update_password()

Fixtures

  • run_fixture()

Changelog

View the change history.

License

This project is licensed under the MIT and Apache Version 2.0

Commit count: 3393

cargo fmt