Skip to main content

cratestack_sqlx/
lib.rs

1pub mod sqlx;
2
3mod audit;
4pub mod backplane;
5mod bound;
6mod delegate;
7mod descriptor;
8mod error;
9mod idempotency;
10mod isolated_run;
11mod isolation;
12mod json;
13mod migrations;
14mod partial_row;
15mod query;
16mod record_policy;
17mod render;
18mod retriable;
19#[cfg(feature = "postgis")]
20mod spatial;
21#[cfg(test)]
22mod tests_audit_actor;
23#[cfg(test)]
24mod tests_bigint;
25#[cfg(test)]
26mod tests_coalesce;
27#[cfg(test)]
28mod tests_create_defaults;
29#[cfg(test)]
30mod tests_descriptor;
31#[cfg(test)]
32mod tests_field_filter;
33#[cfg(test)]
34mod tests_filter_logic;
35#[cfg(test)]
36mod tests_geography;
37#[cfg(test)]
38mod tests_has_role_contract;
39#[cfg(test)]
40mod tests_json;
41#[cfg(test)]
42mod tests_nested_relation_policy;
43#[cfg(test)]
44mod tests_optional;
45#[cfg(test)]
46mod tests_pgvector;
47#[cfg(test)]
48mod tests_policy_precedence_bug;
49#[cfg(test)]
50mod tests_read_policy_field_predicates;
51#[cfg(test)]
52mod tests_read_policy_predicates;
53#[cfg(test)]
54mod tests_relation;
55#[cfg(test)]
56mod tests_relation_scope;
57#[cfg(test)]
58mod tests_relation_scope_fixtures;
59#[cfg(test)]
60mod tests_relation_scope_parity;
61#[cfg(test)]
62mod tests_relation_scope_self;
63#[cfg(test)]
64mod tests_system_principal_policy;
65#[cfg(test)]
66mod tests_update;
67#[cfg(test)]
68mod tests_update_many;
69#[cfg(test)]
70mod tests_upsert_conflict_predicate;
71pub mod topic;
72mod transaction;
73
74pub use partial_row::FromPartialPgRow;
75
76pub use json::Json;
77/// Re-exported so generated code (and the facade crates) can reach
78/// `::cratestack::pgvector::Vector` without depending on the
79/// `pgvector` crate directly — mirrors how `sqlx` above is re-exposed
80/// as a shim rather than depended on separately by every consumer.
81#[cfg(feature = "pgvector")]
82pub use pgvector;
83
84/// Row-decode adapter for PostGIS `geography`/`geometry` columns
85/// (cratestack#842) — re-exported so generated code can name
86/// `::cratestack::Ewkb` without depending on this crate's internals.
87#[cfg(feature = "postgis")]
88pub use spatial::Ewkb;
89
90pub use audit::{
91    AUDIT_TABLE_DDL, RunInTxOutcome, dispatch_audit_sink, primary_key_from_snapshot, snapshot_model,
92};
93pub use error::cratestack_error_from_sqlx;
94pub use idempotency::{SqlxIdempotencyStore, expiry_from};
95pub use isolation::{run_in_isolated_tx, run_in_isolated_tx_with_retries};
96pub use migrations::{
97    MIGRATIONS_TABLE_DDL, Migration, MigrationState, MigrationStatus, apply_pending,
98    ensure_migrations_table, status,
99};
100pub use record_policy::{
101    may_read_some_row, missing_policy_columns, record_readable, refuse_unreadable_subscription,
102};
103pub use transaction::Tx;
104
105pub use cratestack_policy::{PolicyExpr, PolicyLiteral, ReadPolicy, ReadPredicate};
106pub use cratestack_sql::{
107    CoalesceExpr, CoalesceFilter, ConflictTarget, CreateDefault, CreateDefaultType,
108    CreateModelInput, FieldRef, Filter, FilterExpr, FilterOp, GeneratedDefault, GeneratedValue,
109    IntoColumnName, IntoSqlValue, JsonFilter, JsonTextPath, ModelColumn, ModelDescriptor,
110    ModelPrimaryKey, NullOrder, OrderClause, Orderable, Projection, RelatedReadScope,
111    RelationFilter, RelationHop, RelationInclude, RelationQuantifier, SortDirection,
112    SqlColumnValue, SqlValue, Unorderable, UpdateModelInput, UpsertModelInput, VectorDistanceExpr,
113    VectorDistanceFilter, VectorMetric, coalesce, is_orderable, order_value_sql, wrap_filter,
114};
115/// PostGIS query surface (cratestack#842), gated in `cratestack-sql`
116/// and forwarded through this crate's own `postgis` feature.
117#[cfg(feature = "postgis")]
118pub use cratestack_sql::{SpatialDistanceExpr, SpatialFilter, SpatialPoint, point};
119pub use delegate::{
120    ModelDelegate, ScopedAggregate, ScopedAggregateColumn, ScopedAggregateCount, ScopedBatchCreate,
121    ScopedBatchDelete, ScopedBatchGet, ScopedBatchUpdate, ScopedBatchUpsert, ScopedCreateRecord,
122    ScopedDeleteMany, ScopedDeleteRecord, ScopedFindMany, ScopedFindManyWith, ScopedFindUnique,
123    ScopedModelDelegate, ScopedProjectedFindMany, ScopedProjectedFindUnique, ScopedUpdateMany,
124    ScopedUpdateManySet, ScopedUpdateRecord, ScopedUpdateRecordSet, ScopedUpsertRecord,
125    ScopedUpsertRecordDoNothing, ViewDelegate, ViewDelegateNoUnique,
126};
127pub use descriptor::{SqlxRuntime, enqueue_event_outbox, ensure_event_outbox_table};
128pub use query::{
129    Aggregate, AggregateColumn, AggregateCount, BatchCreate, BatchDelete, BatchGet, BatchUpdate,
130    BatchUpdateItem, BatchUpsert, CreateRecord, DeleteMany, DeleteRecord, FindMany, FindManyWith,
131    FindUnique, ProjectedFindMany, ProjectedFindUnique, UpdateMany, UpdateManySet, UpdateRecord,
132    UpdateRecordSet, UpsertOutcome, UpsertRecord, UpsertRecordDoNothing,
133    create_record_with_executor, update_record_with_executor,
134};