fixed warnings
This commit is contained in:
@@ -56,7 +56,7 @@ pub async fn put_table_data(
|
||||
// Validate system columns
|
||||
let system_columns = ["firma", "deleted"];
|
||||
let user_columns: Vec<&String> = columns.iter().map(|(name, _)| name).collect();
|
||||
|
||||
|
||||
// Validate input columns
|
||||
for key in data.keys() {
|
||||
if !system_columns.contains(&key.as_str()) && !user_columns.contains(&key) {
|
||||
@@ -94,17 +94,20 @@ pub async fn put_table_data(
|
||||
return Err(Status::invalid_argument(format!("Value too long for {}", col)));
|
||||
}
|
||||
}
|
||||
params.add(value);
|
||||
params.add(value)
|
||||
.map_err(|e| Status::internal(format!("Failed to add text parameter for {}: {}", col, e)))?;
|
||||
},
|
||||
"BOOLEAN" => {
|
||||
let val = value.parse::<bool>()
|
||||
.map_err(|_| Status::invalid_argument(format!("Invalid boolean for {}", col)))?;
|
||||
params.add(val);
|
||||
params.add(val)
|
||||
.map_err(|e| Status::internal(format!("Failed to add boolean parameter for {}: {}", col, e)))?;
|
||||
},
|
||||
"TIMESTAMPTZ" => {
|
||||
let dt = DateTime::parse_from_rfc3339(value)
|
||||
.map_err(|_| Status::invalid_argument(format!("Invalid timestamp for {}", col)))?;
|
||||
params.add(dt.with_timezone(&Utc));
|
||||
params.add(dt.with_timezone(&Utc))
|
||||
.map_err(|e| Status::internal(format!("Failed to add timestamp parameter for {}: {}", col, e)))?;
|
||||
},
|
||||
_ => return Err(Status::invalid_argument(format!("Unsupported type {}", sql_type))),
|
||||
}
|
||||
@@ -114,8 +117,9 @@ pub async fn put_table_data(
|
||||
}
|
||||
|
||||
// Add ID parameter at the end
|
||||
params.add(record_id);
|
||||
|
||||
params.add(record_id)
|
||||
.map_err(|e| Status::internal(format!("Failed to add record_id parameter: {}", e)))?;
|
||||
|
||||
let set_clause = set_clauses.join(", ");
|
||||
let sql = format!(
|
||||
"UPDATE \"{}\" SET {} WHERE id = ${} AND deleted = FALSE RETURNING id",
|
||||
|
||||
Reference in New Issue
Block a user