validate_adapter_config

Function validate_adapter_config 

Source
fn validate_adapter_config(config: &AdapterConfig) -> Result<(), ConfigError>
Expand description

Validates that the adapter configuration specifies a known adapter type.

This checks the adapter_type field of the provided AdapterConfig and returns an error if it does not map to a supported adapter.

§Returns

Err(ConfigError::UnknownAdapter) if adapter_type is not recognized, Ok(()) otherwise.

§Examples

let cfg = AdapterConfig {
    name: Some("main".into()),
    adapter_type: "postgres".into(),
    connection: "postgres://user:pass@localhost/db".into(),
    options: vec![],
};
assert!(validate_adapter_config(&cfg).is_ok());