effect-sql-kysely
Version:
A full-featured integration between `@effect/sql` and `Kysely` that provides type-safe database operations with Effect's powerful error handling and resource management.
22 lines (17 loc) • 549 B
text/typescript
// Helper for creating a deferred promise
export class DeferredPromise<T> {
readonly _promise: Promise<T>;
_resolve?: (value: T | PromiseLike<T>) => void;
_reject?: (reason?: unknown) => void;
constructor() {
this._promise = new Promise<T>((resolve, reject) => {
this._reject = reject;
this._resolve = resolve;
});
}
get promise(): Promise<T> {
return this._promise;
}
resolve = (value: T | PromiseLike<T>): void => this._resolve?.(value);
reject = (reason?: unknown): void => this._reject?.(reason);
}