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