Skip to main content

nodedb_client/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2
3//! NodeDB client SDK: the [`NodeDb`](traits::NodeDb) trait, the
4//! `NodeDbRemote` client (native MessagePack via TLS, opt-in via the
5//! `native` feature; pgwire compatibility via the `remote` feature), and
6//! capability negotiation.
7//!
8//! For embedded use, depend on `nodedb-lite` directly. For server use,
9//! enable the `native` feature and connect to a NodeDB Origin node via
10//! its native protocol — pgwire compatibility (`remote`) is provided so
11//! existing PostgreSQL drivers can connect for read-mostly workloads, but
12//! it is not the long-term ORM target.
13
14pub mod capabilities;
15pub mod traits;
16
17/// Shared row decoders used by both the trait default impls and the
18/// feature-gated clients. Feature-agnostic on purpose — one parser per
19/// row shape regardless of which transport delivered the row.
20mod row_decode;
21
22/// Shared SQL escaping helpers (string-literal and identifier quoting).
23/// Used by both the native and the remote clients — one implementation
24/// per escape rule, no per-feature duplicates.
25#[cfg(any(feature = "native", feature = "remote"))]
26mod sql_escape;
27
28/// Shared graph-DSL builders and result parsers. Used by both clients so the
29/// `GRAPH ALGO …` SQL construction and row decoding exist once, not per
30/// transport.
31#[cfg(any(feature = "native", feature = "remote"))]
32mod graph_dsl;
33
34#[cfg(feature = "remote")]
35pub mod remote;
36#[cfg(feature = "remote")]
37mod remote_parse;
38
39#[cfg(feature = "native")]
40pub mod native;
41
42pub use capabilities::Capabilities;
43pub use traits::NodeDb;
44
45#[cfg(feature = "remote")]
46pub use remote::NodeDbRemote;
47
48#[cfg(feature = "native")]
49pub use native::builder::ConnectionBuilder;
50#[cfg(feature = "native")]
51pub use native::client::NativeClient;
52
53// Re-export core types so users only need `nodedb-client` in their Cargo.toml.
54pub use nodedb_types::error::{NodeDbError, NodeDbResult};
55pub use nodedb_types::{
56    Document, EdgeFilter, EdgeId, MetadataFilter, NodeId, QueryResult, SearchResult, SubGraph,
57    Value,
58};