Skip to main content

siderite_orm/
lib.rs

1//! `siderite-orm`: backend-neutral ORM core.
2//!
3//! * [`Model`] / [`ModelMeta`]: models and their static metadata, generated by
4//!   `#[derive(Model)]`.
5//! * [`QuerySet`]: lazy, immutable queries compiled into a [`QueryPlan`].
6//! * [`Expr`] / [`Field`]: the typed expression DSL (Django `Q`, `F`, lookups).
7//! * [`WritePlan`]: INSERT / UPDATE / DELETE.
8//! * [`Db`]: the handle application code uses (pool or transaction).
9//! * [`Executor`] / [`Backend`] / [`Transaction`]: implemented by adapters in
10//!   `siderite-backends`; plans are checked against [`BackendCapabilities`]
11//!   before any I/O.
12//!
13//! This crate has **no HTTP dependencies**; the HTTP layer converts
14//! [`OrmError`] into API errors.
15#![forbid(unsafe_code)]
16
17pub mod backend;
18pub mod capabilities;
19pub mod db;
20pub mod decode;
21pub mod error;
22pub mod expr;
23mod m2m;
24pub mod model;
25pub mod ops;
26mod persist;
27pub mod plan;
28pub mod queryset;
29pub mod relations;
30pub mod router;
31pub mod signals;
32pub mod types;
33pub mod value;
34pub mod write;
35
36pub use backend::{Backend, ExecResult, Executor, QueryResult, Row, Transaction};
37pub use capabilities::{
38    BackendCapabilities, BackendKind, Feature, IsolationLevel, RowLocking, TransactionSupport,
39};
40pub use db::{Databases, Db};
41pub use decode::FromValues;
42pub use error::CursorError;
43pub use error::{BackendCapabilityError, BackendError, OrmError, QueryError};
44pub use expr::functions;
45pub use expr::{
46    AggFunc, Aggregate, ArrayAgg, Avg, BinaryOp, Calc, CaseBuilder, Column, Count, CumeDist,
47    DateLike, DatePart, DenseRank, Expr, Field, FirstValue, FkSlot, Function, Joined, Lag,
48    LastValue, Lead, Literal, Lookup, Max, Min, Ntile, Numeric, Operand, PercentRank, Rank, RelHop,
49    Related, RelatedColumn, RowNumber, StdDev, StringAgg, Sum, TextLike, TimeLike, UnaryOp,
50    Variance, Window, WindowFunc,
51};
52pub use model::{
53    ConstraintMeta, DbDefault, FieldMeta, IndexMeta, ManyToManyMeta, MetaRef, Model, ModelMeta,
54    OnDelete, RelationKind, RelationMeta, read_column,
55};
56pub use ops::ModelOps;
57pub use plan::{
58    Compound, DistinctMode, JoinExpr, JoinKind, LockMode, OrderDirection, OrderExpr, PlanOrigin,
59    QueryPlan, QuerySource, SelectExpr, SetOp,
60};
61pub use queryset::{CursorPage, Page, Prefetch, QuerySet, Relation};
62pub use relations::{ForeignKey, ManyToManyManager, OneToOne};
63pub use types::{DbType, SqlType};
64pub use value::Value;
65pub use write::{DeletePlan, InsertPlan, UpdatePlan, WritePlan};