mycelium_base/lib.rs
1/// Defines default Data Transfer Auxiliary structs
2///
3/// This module contains all the auxiliary structs used to transfer data between
4/// layers. These structs are used to transfer data between layers and are not
5/// intended to be used as entities.
6///
7/// # Examples
8///
9/// If you want to create two related structs with database representations and
10/// the relationship between them is established by a foreign key, you can use
11/// Parent and Children.
12///
13/// ```
14/// use mycelium_base::dtos::{Children, Parent};
15///
16/// struct Post {
17/// id: i32,
18/// title: String,
19/// comments: Children<Comment, i32>,
20/// };
21///
22/// struct Comment {
23/// post: Parent<Post, i32>,
24/// id: i32,
25/// text: String,
26/// };
27///
28/// let post_with_comments_as_ids = Post {
29/// id: 1,
30/// title: "Hello World".to_string(),
31/// comments: Children::Ids(vec![1, 2, 3]),
32/// };
33///
34/// let post_with_comments_as_records = Post {
35/// id: 1,
36/// title: "Hello World".to_string(),
37/// comments: Children::Records(vec![
38/// Comment {
39/// post: Parent::Id(1),
40/// id: 1,
41/// text: "Hello World from comment 1".to_string(),
42/// },
43/// Comment {
44/// post: Parent::Id(1),
45/// id: 2,
46/// text: "Hello World from comment 2".to_string(),
47/// },
48/// Comment {
49/// post: Parent::Id(1),
50/// id: 3,
51/// text: "Hello World from comment 3".to_string(),
52/// },
53/// ]),
54/// };
55/// ```
56///
57pub mod dtos;
58
59/// Defines default entities for clean architecture based projects
60///
61/// This module contains all the entities used in the project. Entities are
62/// the core of the project and are used to represent the business logic.
63/// Entities are not intended to be used as Data Transfer Objects.
64pub mod entities;
65
66/// Defines common utilities for error management
67///
68/// This module contains all the utilities used to manage errors in the project.
69/// These utilities are used to manage errors in a clean way.
70pub mod utils;