surreal_sync_json/types/mod.rs
1//! JSON type conversions for sync-core types.
2//!
3//! This module provides bidirectional type conversions between sync-core's
4//! `TypedValue` and JSON formats.
5//!
6//! # Modules
7//!
8//! - [`forward`] - TypedValue → JSON value conversion
9//! - [`reverse`] - JSON value → TypedValue conversion
10//!
11//! # Example
12//!
13//! ```ignore
14//! use surreal_sync_json::types::{JsonValue, JsonValueWithSchema};
15//! use surreal_sync_core::{TypedValue, Type};
16//!
17//! // Forward: TypedValue → JSON value
18//! let tv = TypedValue::text("hello");
19//! let json_val: JsonValue = tv.into();
20//!
21//! // Reverse: JSON value → TypedValue
22//! let json = serde_json::json!(42);
23//! let json_with_schema = JsonValueWithSchema::new(json, Type::Int32);
24//! let tv = json_with_schema.to_typed_value();
25//! ```
26
27pub mod forward;
28pub mod reverse;
29
30pub use forward::JsonValue;
31pub use reverse::{
32 convert_id_to_value, convert_id_with_database_schema, json_to_generated_value_with_config,
33 json_to_typed_value_with_config, json_to_universal_with_table_schema, json_value_to_universal,
34 JsonConversionConfig, JsonValueWithSchema,
35};