What is the proper way to do this? It looks like in 1.0, there was an ExecuteAsync but I'm not seeing how to call that function now.
let internal writeItemToDb conn itemId itemName =
let result =
querySingleAsync<int> (conn)
{
script "
UPDATE items SET name=$n WHERE id = $id;
INSERT OR IGNORE INTO items
(name,id)
VALUES ($n,$id);
// required to not get empty sequence error
select count(1) from items where id = $id"
parameters (dict [
;"n",box itemName
;"id",box itemId])
}
let syncres = Async.RunSynchronously result
match syncres with
|1 -> Ok() // 1 row affected
|_ -> Error (sprintf "Cannot upsert item id %s to database" itemId)