pub struct JsonConversionConfig {
pub boolean_paths: Vec<String>,
pub set_paths: Vec<String>,
}Expand description
Configuration for JSON field conversions.
Some databases (MySQL, PostgreSQL) store boolean values as 0/1 in JSON fields. This struct allows specifying which JSON paths should be converted to boolean values or treated as SET columns (comma-separated arrays).
§Example
use surreal_sync_json::types::JsonConversionConfig;
let config = JsonConversionConfig::new()
.with_boolean_path("settings.enabled")
.with_boolean_path("flags.is_active")
.with_set_path("permissions");Fields§
§boolean_paths: Vec<String>JSON paths that should convert 0/1 to boolean. Paths use dot notation, e.g., “settings.enabled” or “flags.is_active”.
set_paths: Vec<String>JSON paths that should be treated as SET columns (comma-separated arrays).
Implementations§
Source§impl JsonConversionConfig
impl JsonConversionConfig
Sourcepub fn with_boolean_path(self, path: &str) -> Self
pub fn with_boolean_path(self, path: &str) -> Self
Add a boolean path.
Sourcepub fn with_boolean_paths(self, paths: &[&str]) -> Self
pub fn with_boolean_paths(self, paths: &[&str]) -> Self
Add multiple boolean paths.
Sourcepub fn with_set_path(self, path: &str) -> Self
pub fn with_set_path(self, path: &str) -> Self
Add a SET path.
Sourcepub fn with_set_paths(self, paths: &[&str]) -> Self
pub fn with_set_paths(self, paths: &[&str]) -> Self
Add multiple SET paths.
Trait Implementations§
Source§impl Clone for JsonConversionConfig
impl Clone for JsonConversionConfig
Source§fn clone(&self) -> JsonConversionConfig
fn clone(&self) -> JsonConversionConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JsonConversionConfig
impl Debug for JsonConversionConfig
Source§impl Default for JsonConversionConfig
impl Default for JsonConversionConfig
Source§fn default() -> JsonConversionConfig
fn default() -> JsonConversionConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for JsonConversionConfig
impl RefUnwindSafe for JsonConversionConfig
impl Send for JsonConversionConfig
impl Sync for JsonConversionConfig
impl Unpin for JsonConversionConfig
impl UnsafeUnpin for JsonConversionConfig
impl UnwindSafe for JsonConversionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more