import { CookieDB } from "https://deno.land/x/cookie_driver@0.5.1/mod.ts";
Main CookieDB interface
Methods
createUser(options?: { username?: string; token?: string; admin?: boolean; }): Promise<{ username: string; token: string; }>
Creates a user for this database. Requires an administrator token.
get<T>(): Promise<T>
table: string,
key: string,
expandKeys?: boolean,
Get a document from table by key. Optionally can join documents by foreign keys
insert<T>(table: string, document: T): Promise<T extends Array<T> ? string[] : string>
Insert a document into a table and return key
regenerateToken(username: string)
Regenerates a token for a user for this database. Requires an administrator token.
select<T>(): Promise<T[]>
table: string,
where?: string,
options?: { maxResults?: number; expandKeys?: boolean; alias?: Alias; order?: { by: string; descending?: boolean; }; },
Selects a number of documents from a table. Accepts an options argument that specifies the maximum amount of results, whether to display keys, and whether to join documents by foreign keys.