mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-04 06:33:11 +00:00
Use short syntax with nim-results
This commit is contained in:
parent
950990720a
commit
a7ee4b170a
@ -47,8 +47,7 @@ method delete*(
|
|||||||
pending = await allFinished(self.stores.mapIt(it.delete(key)))
|
pending = await allFinished(self.stores.mapIt(it.delete(key)))
|
||||||
|
|
||||||
for fut in pending:
|
for fut in pending:
|
||||||
let res = await fut
|
? await fut
|
||||||
if res.isErr: return res
|
|
||||||
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
@ -61,8 +60,7 @@ method delete*(
|
|||||||
pending = await allFinished(self.stores.mapIt(it.delete(key)))
|
pending = await allFinished(self.stores.mapIt(it.delete(key)))
|
||||||
|
|
||||||
for fut in pending:
|
for fut in pending:
|
||||||
let res = await fut
|
? await fut
|
||||||
if res.isErr: return res
|
|
||||||
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
@ -99,8 +97,7 @@ method put*(
|
|||||||
pending = await allFinished(self.stores.mapIt(it.put(key, data)))
|
pending = await allFinished(self.stores.mapIt(it.put(key, data)))
|
||||||
|
|
||||||
for fut in pending:
|
for fut in pending:
|
||||||
let res = await fut
|
? await fut
|
||||||
if res.isErr: return res
|
|
||||||
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
@ -113,8 +110,7 @@ method put*(
|
|||||||
pending = await allFinished(self.stores.mapIt(it.put(entry.key, entry.data)))
|
pending = await allFinished(self.stores.mapIt(it.put(entry.key, entry.data)))
|
||||||
|
|
||||||
for fut in pending:
|
for fut in pending:
|
||||||
let res = await fut
|
? await fut
|
||||||
if res.isErr: return res
|
|
||||||
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
@ -129,9 +125,8 @@ method modifyGet*(
|
|||||||
var aux = newSeq[byte]()
|
var aux = newSeq[byte]()
|
||||||
|
|
||||||
for fut in pending:
|
for fut in pending:
|
||||||
let res = await fut
|
let res = ? await fut
|
||||||
if res.isErr: return res
|
aux.add(res)
|
||||||
aux.add(res.get)
|
|
||||||
|
|
||||||
return success(aux)
|
return success(aux)
|
||||||
|
|
||||||
@ -144,8 +139,7 @@ method modify*(
|
|||||||
pending = await allFinished(self.stores.mapIt(it.modify(key, fn)))
|
pending = await allFinished(self.stores.mapIt(it.modify(key, fn)))
|
||||||
|
|
||||||
for fut in pending:
|
for fut in pending:
|
||||||
let res = await fut
|
? await fut
|
||||||
if res.isErr: return res
|
|
||||||
|
|
||||||
return success()
|
return success()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user