pub struct Param(/* private fields */);Expand description
A value bound to a ?N placeholder of a D1 query.
Build a list with params!, which calls
IntoParam::into_param on each value, in placeholder order: the first
value binds ?1. A Param is a SQLite NULL, number or text; no
JavaScript value exists until the statement is bound, so building one is
pure Rust and compares with ==.
§Examples
use ocre::{IntoParam, params};
let title = String::from("Hello");
let params = params![&title, 42, true, None::<i64>];
assert_eq!(params.len(), 4);
assert_eq!(params[0], "Hello".into_param());
assert_eq!(params[2], 1_i32.into_param()); // booleans are INTEGER 1/0Trait Implementations§
Source§impl IntoParam for Param
impl IntoParam for Param
Source§fn into_param(self) -> Param
fn into_param(self) -> Param
Converts the value into a bound parameter.
impl StructuralPartialEq for Param
Auto Trait Implementations§
impl Freeze for Param
impl RefUnwindSafe for Param
impl Send for Param
impl Sync for Param
impl Unpin for Param
impl UnsafeUnpin for Param
impl UnwindSafe for Param
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