cynos_jsonb/lib.rs
1//! Cynos JSONB - JSONB data type implementation for Cynos database.
2//!
3//! This crate provides a complete JSONB implementation including:
4//!
5//! - `JsonbValue`: The core JSON value type with sorted object keys
6//! - `JsonbBinary`: Binary encoding/decoding for efficient storage
7//! - `JsonPath`: JSONPath query language support
8//! - `JsonbOp`: PostgreSQL-compatible JSONB operators
9//! - GIN index support for efficient querying
10//!
11//! # Example
12//!
13//! ```rust
14//! use cynos_jsonb::{JsonbValue, JsonbObject, JsonPath, JsonbBinary};
15//!
16//! // Create a JSON object
17//! let mut obj = JsonbObject::new();
18//! obj.insert("name".into(), JsonbValue::String("Alice".into()));
19//! obj.insert("age".into(), JsonbValue::Number(25.0));
20//!
21//! let json = JsonbValue::Object(obj);
22//!
23//! // Query with JSONPath
24//! let path = JsonPath::parse("$.name").unwrap();
25//! let results = json.query(&path);
26//! assert_eq!(results[0], &JsonbValue::String("Alice".into()));
27//!
28//! // Binary encoding
29//! let binary = JsonbBinary::encode(&json);
30//! let decoded = binary.decode();
31//! assert_eq!(json, decoded);
32//! ```
33
34#![no_std]
35
36extern crate alloc;
37
38mod binary;
39mod index;
40mod ops;
41pub mod path;
42mod value;
43
44pub use binary::JsonbBinary;
45pub use ops::JsonbOp;
46pub use path::{CompareOp, JsonPath, JsonPathPredicate, ParseError, PredicateValue};
47pub use value::{JsonbObject, JsonbValue};