Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 7x 4x 4x | import type { SelectExpression, Selection } from "kysely";
import type { Database } from "~db/database";
import type { PeerId, ReceiptId } from "~db/ids";
import type { DB } from "~db/types.gen";
type ReceiptsSelectExpression<TB extends keyof DB> = SelectExpression<DB, TB>;
export const getReceiptParticipant = <
SE extends ReceiptsSelectExpression<"receiptParticipants">,
>(
database: Database,
peerId: PeerId,
receiptId: ReceiptId,
selectExpression: SE[],
): Promise<Selection<DB, "receiptParticipants", SE> | undefined> =>
database
.selectFrom("receiptParticipants")
.where((eb) => eb.and({ receiptId, peerId }))
.select(selectExpression)
.limit(1)
.executeTakeFirst();
|