HeapTableRepo.delete
Deletes a record by the provided unique identifier.
The method is "non-strict" - if there is no record with the given ID in the table, it simply returns null
.
Usage/Signature
table.delete(ctx, id)
-
Arguments
- ctx*:
app.Ctx
Request context. Used for internal implementation and allows executing the request in the appropriate transaction. - id:
string
Unique identifier of the record to be deleted.
- ctx*:
-
Return Value:
Promise<HeapObject | null>
- The just deleted heap-object. If such a record did not exist, it returns
null
.
- The just deleted heap-object. If such a record did not exist, it returns
Examples
Deletion by identifier.
const Orgs = Heap.Table('orgs', {
name: Heap.String(),
})
const org = await Orgs.delete(ctx, 'GfrQQ1xyYWndumSHlzp0chati')
if (org) {
ctx.log(org.name + ' deleted')
} else {
ctx.log('Org not found!')
}