fix(core): show argument index as starting from 0

This commit is contained in:
Ryan Leckey 2021-02-27 00:50:02 -08:00
parent 4c1d2fa679
commit 635bb3e8f1
No known key found for this signature in database
GPG Key ID: F8AA68C235AB08C9

View File

@ -75,7 +75,7 @@ impl<'a, Db: Database> Arguments<'a, Db> {
/// and you attempt to bind a `&str` in Rust, an incompatible type error will be raised.
///
pub fn add<T: 'a + TypeEncode<Db>>(&mut self, value: &'a T) {
let index = self.positional.len() + 1;
let index = self.positional.len();
self.positional.push(Argument::new(Either::Left(index), value, false));
}
@ -87,7 +87,7 @@ impl<'a, Db: Database> Arguments<'a, Db> {
/// will not be hinted when preparing the statement.
///
pub fn add_unchecked<T: 'a + TypeEncode<Db>>(&mut self, value: &'a T) {
let index = self.positional.len() + 1;
let index = self.positional.len();
self.positional.push(Argument::new(Either::Left(index), value, true));
}