method Query.bind
Binds the next ? placeholder of the raw SQL of sqlWhere to v.
Example:
use std.orm { Db }
@table("items")
data Item {
@pk id: i64
name: str
price: i64
}
fn main() io, db {
let db = Db.open("sqlite::memory:")!
db.insert(Item{ id: 1, name: "tea", price: 3 })
db.insert(Item{ id: 2, name: "cake", price: 9 })
let rows = db.Item.query().sqlWhere("price > ?").bind(5).run()
print(rows[0].name)
db.close()
}Output
cake
pub(api) fn bind<P>(v: P) -> Query<T>Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
v | P |
Returns
Query<T>
Effects
none declared (pure unless the body says otherwise)
Defined in: std/orm/orm.oxl:858