UNPKG

userdo

Version:

A Durable Object base class for building applications on Cloudflare Workers.

30 lines (29 loc) 957 B
import { z } from 'zod'; export declare class GenericQuery<T> { private tableName; private storage; private schema; private userId; private getOrganizationContext; private conditions; private orderByClause?; private limitCount?; private offsetCount?; constructor(tableName: string, storage: DurableObjectStorage, schema: z.ZodSchema<T>, userId: string, getOrganizationContext: () => string | undefined); private get organizationContext(); where(path: string, operator: '==' | '!=' | '>' | '<' | 'includes', value: any): this; orderBy(field: string, direction?: 'asc' | 'desc'): this; limit(count: number): this; offset(count: number): this; get(): Promise<Array<T & { id: string; createdAt: Date; updatedAt: Date; }>>; first(): Promise<(T & { id: string; createdAt: Date; updatedAt: Date; }) | null>; count(): Promise<number>; }