Run cargo fmt
. r=me
This commit is contained in:
parent
6d10774fc8
commit
cd9517e5fd
2 changed files with 16 additions and 12 deletions
|
@ -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)
|
||||
data: row.get(2),
|
||||
}
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
for person in person_iter {
|
||||
let p = person.unwrap();
|
||||
|
|
Loading…
Reference in a new issue