supastash
Version:
Offline-first sync engine for Supabase in React Native using SQLite
16 lines (15 loc) • 620 B
JavaScript
import getLocalMethod from "../helpers/localDb/getLocalMethod";
/**
* Queries the local database
* @param state - The state of the query
* @returns The result of the query
*/
export async function queryLocalDb(state) {
const { table, method, payload, filters, limit, select, isSingle, onConflictKeys, preserveTimestamp, type, } = state;
if (!method) {
throw new Error("Method is required for local call");
}
const query = getLocalMethod(table, method, select, payload, filters, limit, isSingle, onConflictKeys, type, preserveTimestamp);
const result = await query();
return result;
}