userdo
Version:
A Durable Object base class that provides user authentication, per-user data storage, and real-time updates for Cloudflare Workers applications.
28 lines (27 loc) • 832 B
TypeScript
import { z } from 'zod';
export declare class GenericQuery<T> {
private tableName;
private storage;
private schema;
private userId;
private conditions;
private orderByClause?;
private limitCount?;
private offsetCount?;
constructor(tableName: string, storage: DurableObjectStorage, schema: z.ZodSchema<T>, userId: string);
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>;
}