cypher_dto/lib.rs
1//! A collection of traits and macros for working Data Transfer Objects (DTOs) Cypher and Neo4j.
2//!
3//! It works with key-value pairs; only structs with named fields are supported.
4//!
5//! This library introduces the Identifier concept, that DTOs can be identified
6//! by a subset of their fields. A [dto::WithId] is an "ordinary" DTO that has
7//! an [dto::Identifier]. Identifiers are also DTOs, but they cannot have an
8//! Identifier themselves.
9//!
10#![doc = include_str!("../include/static_strings.rs")]
11#![doc = include_str!("../include/rename.rs")]
12//!
13//! The `derive` macro will implement [dto::WithId] on the attributed struct,
14//! and create a [dto::Identifier] struct named e.g. `FooId`. The ID struct will use the
15//! same [typename()] as the attributed struct, and include any fields that are
16//! marked `#[id]` on it.
17//!
18//! If no fields are marked `#[id]`, then the id field(s) are inferred:
19//! - If there is a field named `id`, that will be the singular ID field in e.g. `FooId`.
20//! - Otherwise, *all* fields from the attributed struct will also be on the ID struct.
21//!
22//! Dynamically added methods:
23//! 1. `fn into_values(self)` - returns a tuple of all the values in the struct.
24
25// #![warn(missing_docs)]
26// #![deny(rustdoc::broken_intra_doc_links)]
27
28mod entity;
29mod error;
30mod format;
31mod node;
32mod relationship;
33mod stamps;
34
35#[cfg(feature = "macros")]
36pub use cypher_dto_macros::{timestamps, Node, Relation};
37
38pub use entity::{FieldSet, StampMode};
39pub use error::Error;
40pub use format::{format_param, format_query_fields};
41pub use node::{NodeEntity, NodeId};
42pub use relationship::{RelationBound, RelationEntity, RelationId};
43pub use stamps::{Neo4jMap, Stamps};