Skip to main content

hyperdb_compile_check/
lib.rs

1// Copyright (c) 2026, Salesforce, Inc. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Compile-time SQL validation logic for `hyperdb-api`.
5//!
6//! This is a **regular library crate** (not a proc-macro crate) so that its
7//! validation logic — registry, dry-run, SQLSTATE classification, name-subset
8//! diff — can be unit-tested with standard `cargo test` without `trybuild`.
9//!
10//! The proc-macro shells in `hyperdb-api-derive` call into this crate when the
11//! `compile-time` feature is enabled. No `syn`/`quote`/`proc-macro2` types
12//! appear in this crate's public API.
13//!
14//! # Architecture
15//!
16//! ```text
17//! hyperdb-api-derive  (proc-macro shell, thin)
18//!   └─(compile-time feature)─→ hyperdb-compile-check  (this crate, testable)
19//!                                  └─→ hyperdb-api  (HyperProcess, Connection, …)
20//! ```
21//!
22//! The three-crate split avoids the circular dependency that would arise from
23//! adding `hyperdb-api` as a direct dep of `hyperdb-api-derive` (which
24//! `hyperdb-api` already depends on).
25
26pub mod db;
27pub mod diagnostic;
28pub mod dry_run;
29pub mod error_extract;
30pub mod registry;
31pub mod validate;
32
33pub use db::CompileTimeDb;
34pub use diagnostic::ValidationError;
35pub use registry::Registry;
36pub use validate::{validate_query_as, validate_scalar_sql};