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 the trait default impls and the feature-gated
18/// clients. One parser per row shape, whichever transport delivered the row.
19/// A decoder used only by the clients compiles under their features.
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 decoders. Used by both clients so the
29/// `GRAPH ALGO`, `GRAPH TRAVERSE` and `GRAPH PATH` SQL construction and result
30/// decoding exist once, not per transport.
31#[cfg(any(feature = "native", feature = "remote"))]
32mod graph_dsl;
33
34/// The identity column of a stored schemaless document, shared by both
35/// clients so a document reads back with the same fields whichever wrote it.
36#[cfg(any(feature = "native", feature = "remote"))]
37mod document_identity;
38
39/// Shared search SQL builders: the text-search statement and the allowed-id
40/// key conjunct. Used by both clients, so both send the same statement.
41#[cfg(any(feature = "native", feature = "remote"))]
42mod search_sql;
43
44#[cfg(feature = "remote")]
45mod pg_cell;
46#[cfg(feature = "remote")]
47pub mod remote;
48#[cfg(feature = "remote")]
49mod remote_parse;
50
51#[cfg(feature = "native")]
52pub mod native;
53
54pub use capabilities::Capabilities;
55pub use traits::NodeDb;
56
57#[cfg(feature = "remote")]
58pub use remote::NodeDbRemote;
59
60#[cfg(feature = "native")]
61pub use native::builder::ConnectionBuilder;
62#[cfg(feature = "native")]
63pub use native::client::NativeClient;
64
65// Re-export core types so users only need `nodedb-client` in their Cargo.toml.
66pub use nodedb_types::error::{NodeDbError, NodeDbResult};
67pub use nodedb_types::{
68    Document, EdgeFilter, EdgeId, MetadataFilter, NodeId, QueryResult, SearchResult, SubGraph,
69    Value,
70};