parse_field_def

Function parse_field_def 

Source
fn parse_field_def(config: FieldConfig) -> Result<FieldDef, ConfigError>
Expand description

Converts a YAML-deserialized FieldConfig into the internal FieldDef.

The function parses the textual field_type into a FieldType and constructs a FieldDef preserving name, nullable, and default. The security field is set to None because YAML-based security is not supported yet.

§Returns

FieldDef built from the given config; Err(ConfigError) if the field_type is invalid.

§Examples

let cfg = FieldConfig {
    name: "id".to_string(),
    field_type: "uuid".to_string(),
    nullable: false,
    default: None,
};
let def = parse_field_def(cfg).unwrap();
assert_eq!(def.name, "id");