Run cargo fmt. r=me

This commit is contained in:
Brian Grinstead 2017-01-10 10:54:37 -08:00
parent 6d10774fc8
commit cd9517e5fd
2 changed files with 16 additions and 12 deletions

View file

@ -18,12 +18,12 @@ use rusqlite::Connection;
pub mod ident;
pub fn get_name() -> String {
return String::from("mentat");
return String::from("mentat");
}
// Just an example of using a dependency
pub fn get_parser_name() -> String {
return mentat_query_parser::get_name();
return mentat_query_parser::get_name();
}
// Will ultimately not return the sqlite connection directly

View file

@ -17,7 +17,7 @@ fn can_import_sqlite() {
struct Person {
id: i32,
name: String,
data: Option<Vec<u8>>
data: Option<Vec<u8>>,
}
let conn = mentat::get_connection();
@ -26,24 +26,28 @@ fn can_import_sqlite() {
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
data BLOB
)", &[]).unwrap();
)",
&[])
.unwrap();
let me = Person {
id: 1,
name: "Steven".to_string(),
data: None
data: None,
};
conn.execute("INSERT INTO person (name, data)
VALUES (?1, ?2)",
&[&me.name, &me.data]).unwrap();
&[&me.name, &me.data])
.unwrap();
let mut stmt = conn.prepare("SELECT id, name, data FROM person").unwrap();
let person_iter = stmt.query_map(&[], |row| {
Person {
id: row.get(0),
name: row.get(1),
data: row.get(2)
}
}).unwrap();
Person {
id: row.get(0),
name: row.get(1),
data: row.get(2),
}
})
.unwrap();
for person in person_iter {
let p = person.unwrap();