mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 09:09:19 +08:00
rustfmt
This commit is contained in:
parent
24024b90b6
commit
8124953882
@ -31,9 +31,9 @@ impl FromSql for Value {
|
|||||||
let blob = try!(Vec::<u8>::column_result(stmt, col));
|
let blob = try!(Vec::<u8>::column_result(stmt, col));
|
||||||
serde_json::from_slice(&blob)
|
serde_json::from_slice(&blob)
|
||||||
}
|
}
|
||||||
_ => return Err(Error::InvalidColumnType)
|
_ => return Err(Error::InvalidColumnType),
|
||||||
};
|
};
|
||||||
value_result.map_err(|err| { Error::FromSqlConversionFailure(Box::new(err)) })
|
value_result.map_err(|err| Error::FromSqlConversionFailure(Box::new(err)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,8 +55,8 @@ mod test {
|
|||||||
let json = r#"{"foo": 13, "bar": "baz"}"#;
|
let json = r#"{"foo": 13, "bar": "baz"}"#;
|
||||||
let data: serde_json::Value = serde_json::from_str(json).unwrap();
|
let data: serde_json::Value = serde_json::from_str(json).unwrap();
|
||||||
db.execute("INSERT INTO foo (t, b) VALUES (?, ?)",
|
db.execute("INSERT INTO foo (t, b) VALUES (?, ?)",
|
||||||
&[&data, &json.as_bytes()])
|
&[&data, &json.as_bytes()])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let t: serde_json::Value = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)).unwrap();
|
let t: serde_json::Value = db.query_row("SELECT t FROM foo", &[], |r| r.get(0)).unwrap();
|
||||||
assert_eq!(data, t);
|
assert_eq!(data, t);
|
||||||
|
Loading…
Reference in New Issue
Block a user