re structure result type nesting combined with correct .into call

this was a bit of a trip!  we will see if I actually did this correctly
later...
This commit is contained in:
Conrad Dean 2019-07-22 22:30:08 -04:00
parent 4d92e3eef9
commit ae9f969e59

View file

@ -64,13 +64,15 @@ impl SyncMetadata {
}
pub fn remote_head(tx: &rusqlite::Transaction) -> Result<Uuid> {
tx.query_row(
"SELECT value FROM tolstoy_metadata WHERE key = ?",
&[&schema::REMOTE_HEAD_KEY], |r| {
let bytes: Vec<u8> = r.get(0).unwrap();
Uuid::from_bytes(bytes.as_slice())
}
)?.map_err(|e| e.into())
Uuid::from_bytes(
tx.query_row(
"SELECT value FROM tolstoy_metadata WHERE key = ?",
rusqlite::params![&schema::REMOTE_HEAD_KEY], |r| {
let bytes: Vec<u8> = r.get(0).unwrap();
Ok(bytes)
}
)?.as_slice()
).map_err(|e| e.into())
}
pub fn set_remote_head(tx: &rusqlite::Transaction, uuid: &Uuid) -> Result<()> {