pub fn add_fragment(
config_json: &str,
fragment_config: &Value,
) -> Result<(String, i64)>Expand description
Add a new fragment to the configuration
§Arguments
config_json- Configuration JSON stringfragment_config- JSON configuration for the fragment (must include ERFRAG_CODE)
§Returns
Returns (modified_config, new_fragment_id) tuple on success
§Example
use sz_configtool_lib::fragments;
use serde_json::json;
let config = r#"{"G2_CONFIG": {"CFG_ERFRAG": []}}"#;
let frag_config = json!({
"ERFRAG_CODE": "CUSTOM_FRAG",
"ERFRAG_SOURCE": "NAME+ADDRESS"
});
let (modified, frag_id) = fragments::add_fragment(config, &frag_config).unwrap();
assert_eq!(frag_id, 1);