@orbitinghail/sqlsync-worker
Version:
SQLSync is a collaborative offline-first wrapper around SQLite. It is designed to synchronize web application state between users, devices, and the edge.
20 lines (19 loc) • 875 B
TypeScript
import { QueryKey, SqlValue } from "../sqlsync-wasm/pkg/sqlsync_wasm";
export interface ParameterizedQuery {
sql: string;
params: SqlValue[];
}
export declare function normalizeQuery(query: ParameterizedQuery | string): ParameterizedQuery;
/**
* Returns a parameterized query object with the given SQL string and parameters.
* This function should be used as a template literal tag.
*
* @example
* const query = sql`SELECT * FROM users WHERE id = ${userId}`;
*
* @param chunks - An array of string literals.
* @param params - An array of parameter values to be inserted into the SQL string.
* @returns A parameterized query object with the given SQL string and parameters.
*/
export declare function sql(chunks: readonly string[], ...params: SqlValue[]): ParameterizedQuery;
export declare function toQueryKey(query: ParameterizedQuery): Promise<QueryKey>;