[][src]Trait sql_builder::bind::Bind

pub trait Bind {
    fn bind(&self, arg: &dyn SqlArg) -> String;
fn binds(&self, args: &[&dyn SqlArg]) -> String; }

Required methods

fn bind(&self, arg: &dyn SqlArg) -> String

fn binds(&self, args: &[&dyn SqlArg]) -> String

Loading content...

Implementations on Foreign Types

impl<'_> Bind for &'_ str[src]

fn bind(&self, arg: &dyn SqlArg) -> String[src]

Replace first ? with a value.

use sql_builder::prelude::*;

let sql = SqlBuilder::select_from("books")
    .fields(&["title", "price"])
    .and_where("price BETWEEN ? AND ?".bind(&100).bind(&200))
    .sql()?;

assert_eq!("SELECT title, price FROM books WHERE price BETWEEN 100 AND 200;", &sql);

fn binds(&self, args: &[&dyn SqlArg]) -> String[src]

Cyclic bindings of values.

use sql_builder::prelude::*;

let sql = SqlBuilder::select_from("books")
    .fields(&["title", "price"])
    .and_where("price > ? AND title LIKE ?".binds(&[&100, &"Harry Potter%"]))
    .sql()?;

assert_eq!("SELECT title, price FROM books WHERE price > 100 AND title LIKE 'Harry Potter%';", &sql);
// add             ^^^^^^^^^^^^
// here               fields

impl Bind for String[src]

Loading content...

Implementors

Loading content...