|
@@ -46,7 +46,6 @@
|
|
|
//! let mut lease = cpool.acquire()?;
|
|
|
//! let schema = KVSchema::default();
|
|
|
//! schema.install(&mut lease)?;
|
|
|
-//! // let db = KVSchema::open_path(":memory:")?;
|
|
|
//! schema.kvs.insert(&mut lease, KVEntry {
|
|
|
//! key: "example_key".to_string(),
|
|
|
//! value: "example_value".to_string()
|
|
@@ -119,13 +118,14 @@
|
|
|
//! #[derive(Entity)]
|
|
|
//! pub struct Customer {
|
|
|
//! pub orders: microrm::RelationDomain<CustomerOrders>,
|
|
|
-//!
|
|
|
+//! // mark as part of the primary key
|
|
|
//! #[key]
|
|
|
//! pub email: String,
|
|
|
-//!
|
|
|
+//! // enforce uniqueness of legal names
|
|
|
//! #[unique]
|
|
|
//! pub legal_name: String,
|
|
|
//!
|
|
|
+//! // elide the secrets from Debug output
|
|
|
//! #[elide]
|
|
|
//! pub password_salt: String,
|
|
|
//! #[elide]
|
|
@@ -144,13 +144,15 @@
|
|
|
//!
|
|
|
//! #[derive(Entity)]
|
|
|
//! pub struct Order {
|
|
|
+//! // use an ordinary type and do transparent JSON de/serialization
|
|
|
//! pub order_state: microrm::Serialized<Vec<OrderState>>,
|
|
|
//! pub customer: microrm::RelationRange<CustomerOrders>,
|
|
|
//! pub shipping_address: String,
|
|
|
//!
|
|
|
+//! // we may not have a billing address
|
|
|
//! pub billing_address: Option<String>,
|
|
|
//!
|
|
|
-//! // we'll assume for now that there's no product multiplicities, i.e. this is not a multiset
|
|
|
+//! // we'll assume for now that there's no product multiplicities, i.e. `contents` is not a multiset
|
|
|
//! pub contents: microrm::RelationMap<Product>,
|
|
|
//! }
|
|
|
//!
|
|
@@ -165,7 +167,6 @@
|
|
|
//! let cpool = microrm::ConnectionPool::new(":memory:")?;
|
|
|
//! let mut lease = cpool.acquire()?;
|
|
|
//! let schema = ECommerceDB::default();
|
|
|
-//! // let db = ECommerceDB::open_path(":memory:")?;
|
|
|
//! schema.install(&mut lease);
|
|
|
//!
|
|
|
//! // add an example product
|
|
@@ -244,7 +245,7 @@ pub use schema::{IDMap, Serialized, Stored};
|
|
|
#[cfg(feature = "clap")]
|
|
|
pub mod cli;
|
|
|
|
|
|
-/// Module prelude with commonly-used traits that shouldn't have overlap with other crates.
|
|
|
+/// Re-exported traits and macros for easy access.
|
|
|
pub mod prelude {
|
|
|
pub use crate::query::{Insertable, Queryable, RelationInterface};
|
|
|
pub use crate::schema::{relation::Relation, Schema, Serializable};
|