it is now properly working, properly saving stuff
This commit is contained in:
@@ -19,7 +19,17 @@ fn validate_target_column(
|
|||||||
let columns: Vec<String> = serde_json::from_value(table_columns.clone())
|
let columns: Vec<String> = serde_json::from_value(table_columns.clone())
|
||||||
.map_err(|e| format!("Invalid column data: {}", e))?;
|
.map_err(|e| format!("Invalid column data: {}", e))?;
|
||||||
|
|
||||||
if !columns.iter().any(|c| c == target) {
|
// Extract column names from the format "\"column_name\" TYPE"
|
||||||
|
let column_names: Vec<&str> = columns
|
||||||
|
.iter()
|
||||||
|
.filter_map(|c| {
|
||||||
|
c.split_whitespace()
|
||||||
|
.next()
|
||||||
|
.map(|s| s.trim_matches('"'))
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
if !column_names.contains(&target) {
|
||||||
return Err(format!("Target column {} not defined in table {}", target, table_name));
|
return Err(format!("Target column {} not defined in table {}", target, table_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user