UNPKG

supastash

Version:

Offline-first sync engine for Supabase in React Native using SQLite

21 lines (20 loc) 596 B
import { getSupastashDb } from "../db/dbInitializer"; import { logError } from "./logs"; /** * Updates synced_at from null to a timeStamp * @param tableName - The name of the table to update * @param id - The id of the row to update */ export async function updateLocalSyncedAt(tableName, id) { try { const db = await getSupastashDb(); const timeStamp = new Date().toISOString(); await db.runAsync(`UPDATE ${tableName} SET synced_at = ? WHERE id = ?`, [ timeStamp, id, ]); } catch (error) { logError(error); } }