pub trait QueryBuilderSetObject {
    fn set_querybuilder_object<'b>(
        querybuilder: QueryBuilder<'b>
    ) -> QueryBuilder<'b>; }
Expand description

This trait allows you to easily and safely convert a type into a series of statements. One such case being a series of field = $field statements.

Example

impl QueryBuilderSetObject for Account {
 fn set_querybuilder_object<'a>(mut querybuilder: QueryBuilder<'a>) -> QueryBuilder {
   let a = &[
     querybuilder.hold(schema::handle.equals_parameterized()),
     querybuilder.hold(schema::password.equals_parameterized()),
     querybuilder.hold(schema::email.equals_parameterized()),
     querybuilder.hold(schema::roles.equals_parameterized()),
   ];

   querybuilder.set_many(a)
 }
}

which can be used like so:

let query = QueryBuilder::new()
  .create("Account:John")
  .set_object::<Account>()
  .build();

assert_eq!(
  "CREATE Account:John SET handle = $handle , password = $password , email = $email , roles = $roles",
  query
);

Refer to the test.rs file to a more complete example.

Required Methods

Implementors