#[non_exhaustive]pub struct CardParam {
pub n: u32,
pub column: String,
pub ty: ValType,
}Expand description
One $N parameter slot of a QueryCard, with the column it binds
and that column’s declared type.
let c = kevy_sql::compile(
"CREATE TABLE orders (id bigint PRIMARY KEY, user_id bigint);
CREATE INDEX ON orders (user_id);
CREATE VIEW by_user AS SELECT * FROM orders WHERE user_id = $1;",
)?;
let p = &c.query_cards[0].params[0];
assert_eq!((p.n, p.column.as_str(), p.ty), (1, "user_id", kevy_sql::ValType::I64));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.n: u32The 1-based parameter number ($1 → 1).
let c = kevy_sql::compile(
"CREATE TABLE orders (id bigint PRIMARY KEY, user_id bigint);
CREATE INDEX ON orders (user_id);
CREATE VIEW by_user AS SELECT * FROM orders WHERE user_id = $1;",
)?;
assert_eq!(c.query_cards[0].params[0].n, 1);column: StringThe declared column the slot binds.
let c = kevy_sql::compile(
"CREATE TABLE orders (id bigint PRIMARY KEY, user_id bigint);
CREATE INDEX ON orders (user_id);
CREATE VIEW by_user AS SELECT * FROM orders WHERE user_id = $1;",
)?;
assert_eq!(c.query_cards[0].params[0].column, "user_id");ty: ValTypeThe column’s declared kevy type (i64, f64 or str: the SQL
type mapping never yields another).
let c = kevy_sql::compile(
"CREATE TABLE orders (id bigint PRIMARY KEY, user_id bigint);
CREATE INDEX ON orders (user_id);
CREATE VIEW by_user AS SELECT * FROM orders WHERE user_id = $1;",
)?;
assert_eq!(c.query_cards[0].params[0].ty, kevy_sql::ValType::I64);Trait Implementations§
impl Eq for CardParam
impl StructuralPartialEq for CardParam
Auto Trait Implementations§
impl Freeze for CardParam
impl RefUnwindSafe for CardParam
impl Send for CardParam
impl Sync for CardParam
impl Unpin for CardParam
impl UnsafeUnpin for CardParam
impl UnwindSafe for CardParam
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