Expand description
Cynos JSONB - JSONB data type implementation for Cynos database.
This crate provides a complete JSONB implementation including:
JsonbValue: The core JSON value type with sorted object keysJsonbBinary: Binary encoding/decoding for efficient storageJsonPath: JSONPath query language supportJsonbOp: PostgreSQL-compatible JSONB operators- GIN index support for efficient querying
§Example
use cynos_jsonb::{JsonbValue, JsonbObject, JsonPath, JsonbBinary};
// Create a JSON object
let mut obj = JsonbObject::new();
obj.insert("name".into(), JsonbValue::String("Alice".into()));
obj.insert("age".into(), JsonbValue::Number(25.0));
let json = JsonbValue::Object(obj);
// Query with JSONPath
let path = JsonPath::parse("$.name").unwrap();
let results = json.query(&path);
assert_eq!(results[0], &JsonbValue::String("Alice".into()));
// Binary encoding
let binary = JsonbBinary::encode(&json);
let decoded = binary.decode();
assert_eq!(json, decoded);Re-exports§
pub use path::CompareOp;pub use path::JsonPath;pub use path::JsonPathPredicate;pub use path::ParseError;pub use path::PredicateValue;
Modules§
- path
- JSONPath module for JSONB queries.
Structs§
- Jsonb
Binary - Binary representation of a JSONB value.
- Jsonb
Object - A JSON object with keys sorted for efficient lookup.
Enums§
- JsonbOp
- JSONB operations that can be applied to values.
- Jsonb
Value - A JSON value with optimized storage for database operations.