Skip to main content

get_next_id

Function get_next_id 

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

Get the next available ID for a config section with optional seed value

Navigates to a config section using a path and finds the next available ID. Useful for user-created items that should start at a specific ID (e.g., 1000).

§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”)
  • seed_value - Minimum value to return (e.g., 1000 for user items)

§Returns

Next available ID value, at least seed_value

§Errors

Returns error if section path not found