pub struct Parameters { /* private fields */ }
Expand description
Generator of PostgreSQL parameter placeholders for dynamic statements with multiple values
§Example
use scooby::postgres::Parameters;
let mut params = Parameters::new();
let p1 = params.next();
let p2 = params.next();
let p345 = params.next_n(3);
let p67 = params.next_array::<2>();
assert_eq!(p1, "$1");
assert_eq!(p2, "$2");
assert_eq!(p345, "$3, $4, $5");
assert_eq!(p67, ["$6", "$7"]);
Implementations§
Source§impl Parameters
impl Parameters
Sourcepub fn new() -> Parameters
pub fn new() -> Parameters
Make a new Parameters counter, starting with 1
Sourcepub fn starting_from(first: usize) -> Parameters
pub fn starting_from(first: usize) -> Parameters
Make a new Parameters counter, starting with passed number
Sourcepub fn next(&mut self) -> String
pub fn next(&mut self) -> String
Return the current parameter placeholder in $x
format, and increase the internal counter
Sourcepub fn next_array<const N: usize>(&mut self) -> [String; N]
pub fn next_array<const N: usize>(&mut self) -> [String; N]
Return N next placeholders as an array of size N
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Parameters
impl RefUnwindSafe for Parameters
impl Send for Parameters
impl Sync for Parameters
impl Unpin for Parameters
impl UnwindSafe for Parameters
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more