Skip to content

Commit

Permalink
Renamed Insert values property
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanchiz1 committed Dec 28, 2024
1 parent 86c2b63 commit e08cc34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions eloquent_core/src/compilers/inserts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ pub(crate) fn format<'a>(

sql.push_str(") VALUES ");

let row_count = inserts.first().map_or(0, |insert| insert.value.len());
let row_count = inserts.first().map_or(0, |insert| insert.values.len());

let mut value_placeholders = vec![];
for i in 0..row_count {
let row_values: Vec<_> = inserts
.iter()
.map(|insert| {
params.push(&insert.value[i]);
params.push(&insert.values[i]);
"?".to_string()
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion eloquent_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct Select {

struct Insert {
column: String,
value: Vec<Box<dyn ToSql>>,
values: Vec<Box<dyn ToSql>>,
}

struct Update {
Expand Down
4 changes: 2 additions & 2 deletions eloquent_core/src/queries/inserts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ impl QueryBuilder {

fn add_insert(&mut self, column: &str, value: impl ToSql + 'static) {
if let Some(insert) = self.inserts.iter_mut().find(|i| i.column == column) {
insert.value.push(Box::new(value));
insert.values.push(Box::new(value));
} else {
self.inserts.push(Insert {
column: column.to_string(),
value: vec![Box::new(value)],
values: vec![Box::new(value)],
});
}
}
Expand Down

0 comments on commit e08cc34

Please sign in to comment.