pub struct Values { /* private fields */ }
Expand description

Builder to contruct a Values command

Implementations

Gets the current state of the Values and returns it as string

Examples
use sql_query_builder as sql;

let query = sql::Values::new()
  .values("('foo', 'Foo')")
  .as_string();

Output

VALUES ('foo', 'Foo')

Prints the current state of the Values into console output in a more ease to read version. This method is useful to debug complex queries or just to print the generated SQL while you type

Examples
use sql_query_builder as sql;

let values = sql::Values::new()
  .values("(1, 'one'), (2, 'two')")
  .values("(3, 'three')")
  .debug();

Output

VALUES (1, 'one'), (2, 'two'), (3, 'three')

Create Values’s instance

Prints the current state of the Values into console output similar to debug method, the difference is that this method prints in one line.

Adds at the beginning a raw SQL query.

Examples
use sql_query_builder as sql;

let raw_query = "insert into my_table(nun, txt)";
let values = sql::Values::new()
  .raw(raw_query)
  .values("(1, 'one'), (2, 'two')")
  .debug();

Output

insert into my_table(num, txt)
VALUES (1, 'one'), (2, 'two')

Adds a raw SQL query after a specified clause.

Examples
use sql_query_builder as sql;

let raw_query = ", (3, 'three')";
let values = sql::Values::new()
  .values("(1, 'one'), (2, 'two')")
  .raw_after(sql::ValuesClause::Values, raw_query)
  .debug();

Output

VALUES (1, 'one'), (2, 'two') , (3, 'three')

Adds a raw SQL query before a specified clause.

Examples
use sql_query_builder as sql;

let raw_query = "/* the values command */";
let values = sql::Values::new()
  .raw_before(sql::ValuesClause::Values, raw_query)
  .values("(1, 'one'), (2, 'two')")
  .debug();

Output

/* the values command */
VALUES (1, 'one'), (2, 'two')

The values clause

Examples
use sql_query_builder as sql;

let values = sql::Values::new()
  .values("(1, 'one'), (2, 'two')")
  .values("(3, 'three')");

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.