Skip to main content

parse_rust_storage/
lib.rs

1//! `StorageAdapter` trait and the query/update AST adapters lower.
2//!
3//! **The trait must be shaped by two consumers, not one.** Building against Mongo alone bakes
4//! Mongo-isms (BSON semantics, `$` operators, implicit schema) into the interface, and the
5//! Postgres port then fights it, which is roughly what happened upstream and produced the 55
6//! catalogued divergences. The rule: if a method can only be implemented sensibly for one
7//! backend, the trait is wrong.
8//!
9//! 0.2.0 added the query tree (`$or`/`$and`/`$nor`), the update op AST, atomic field reservation,
10//! join-table primitives and schema mutation. Aggregation, distinct and transactions are still
11//! absent, and a batch that asks for a transaction is refused rather than silently run without
12//! one.
13
14#![forbid(unsafe_code)]
15#![cfg_attr(
16    not(test),
17    deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)
18)]
19
20pub mod adapter;
21pub mod query;
22pub mod schema;
23
24pub use adapter::{AddFieldOutcome, Row, SchemaIndex, StorageAdapter, WriteResult};
25pub use query::{
26    Clause, Comparison, Constraint, Query, QueryOptions, SortDirection, Update, UpdateValue,
27    DEFAULT_LIMIT,
28};
29pub use schema::{join_schema, join_table_name, ClassSchema, FieldType};