1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Cape: Type-safe record and persistence state management
//!
//! Cape provides a type-safe way to manage domain objects with persistence
//! state tracking. Records wrap domain objects with metadata, relations, and
//! track their persistence state at the type level to prevent common database
//! synchronization errors.
//!
//! ## Core Concepts
//!
//! - **Record<T, R, S, K>**: Wraps a domain object `T` with relations `R`,
//! persistence state `S`, and key type `K`
//! - **Persistence States**: Type-level tracking of whether records are new
//! (`N`) or stored (`S`)
//! - **Inner Trait**: Marker trait for types that can be stored in records
//! - **`Id<K>`**: Optional identifier wrapper that enforces correct usage
//! patterns
//! - **Timestamps**: Creation and update time tracking (optional chrono
//! integration)
//!
//! ## Example
//!
//! ```rust
//! use cape::prelude::*;
//!
//! #[derive(Clone)]
//! struct User {
//! name: String,
//! email: String,
//! }
//!
//! // Create a new record (type: Record<User, (), N, i64>)
//! let new_user: Record<User, (), N, i64> = Record::new(User {
//! name: "Alice".to_string(),
//! email: "alice@example.com".to_string(),
//! });
//!
//! // After saving to database, convert to stored state
//! // let stored_user = new_user.store(123, timestamp);
//! // let user_id = stored_user.id(); // Only available for stored records
//! ```
pub
pub
pub
pub
pub
pub use Id;
pub use ;
pub use ;
pub use Record;
pub use Timestamp;