postgres_extras 0.1.0

Provides extentions and utilites for working with postgres.
Documentation
use std::collections::HashMap;

use postgres_extras::{ sql, SqlIterExt };
#[test]
fn tuple_fragment_hashmap() {
    let text = "what".to_owned();
    let mut map: HashMap<&str,i32> = HashMap::new();
    map.insert("hell", 32);
    map.insert("wow", 42);
    map.insert(&text, 33);
    let bindings_count = sql!(INSERT INTO table VALUES #{
        map.iter().into_sql_tuples()
    }).bindings.len();
    assert_eq!(bindings_count, 6);
}

#[test]
fn tuple_fragment_slice() {
    let text = "what".to_owned();
    let map = &[
        ("hello", 32i32),
        ("wow", 534),
        (&text, 514),
    ];
    let bindings_count = sql!(INSERT INTO table VALUES #{
        map.iter().into_sql_tuples()
    }).bindings.len();
    assert_eq!(bindings_count, 6);
}