1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

fix(ext/kv): expose Deno.AtomicOperation (#19674)

This commit is contained in:
Luca Casonato 2023-07-01 09:24:15 +02:00 committed by GitHub
parent dd508c9c89
commit 476e4ed03c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -46,7 +46,7 @@ Deno.test({
},
});
function dbTest(name: string, fn: (db: Deno.Kv) => Promise<void>) {
function dbTest(name: string, fn: (db: Deno.Kv) => Promise<void> | void) {
Deno.test({
name,
// https://github.com/denoland/deno/issues/18363
@ -58,7 +58,7 @@ function dbTest(name: string, fn: (db: Deno.Kv) => Promise<void>) {
try {
await fn(db);
} finally {
await db.close();
db.close();
}
},
});
@ -1750,3 +1750,9 @@ Deno.test({
}
},
});
dbTest("atomic operation is exposed", (db) => {
assert(Deno.AtomicOperation);
const ao = db.atomic();
assert(ao instanceof Deno.AtomicOperation);
});

View file

@ -657,4 +657,4 @@ class KvListIterator extends AsyncIterator
}
}
export { Kv, KvListIterator, KvU64, openKv };
export { AtomicOperation, Kv, KvListIterator, KvU64, openKv };

View file

@ -173,6 +173,7 @@ const denoNsUnstable = {
upgradeHttp: http.upgradeHttp,
serve: http.serve,
openKv: kv.openKv,
AtomicOperation: kv.AtomicOperation,
Kv: kv.Kv,
KvU64: kv.KvU64,
KvListIterator: kv.KvListIterator,