Skip to main content

get_desired_or_next_id_from_section

Function get_desired_or_next_id_from_section 

Source
pub fn get_desired_or_next_id_from_section(
    config_data: &Value,
    section_path: &str,
    id_field: &str,
    desired_id: Option<i64>,
    seed_value: i64,
) -> Result<i64>
Expand description

Get the next available ID or use desired ID (for config sections)

Same as get_desired_or_next_id but works with section paths

§Arguments

  • config_data - Parsed configuration JSON Value
  • section_path - Dot-separated path (e.g., “G2_CONFIG.CFG_SFCALL”)
  • id_field - Name of the ID field (e.g., “SFCALL_ID”)
  • desired_id - Optional user-specified ID
  • seed_value - Minimum value to return (e.g., 1000 for user items)

§Returns

ID to use (either desired_id or next available)

§Errors

Returns error if section not found or desired_id is already taken