push method
Future<void>
push(
- String table,
- String id,
- SyncOperation operation,
- Map<
String, dynamic> data,
override
Push a single record to the remote.
Implementation
@override
Future<void> push(
String table,
String id,
SyncOperation operation,
Map<String, dynamic> data,
) async {
try {
switch (operation) {
case SyncOperation.upsert:
await client.from(table).upsert(data);
case SyncOperation.delete:
await client.from(table).delete().eq('id', id);
case SyncOperation.patch:
await client.from(table).update(data).eq('id', id);
}
} on AuthException catch (e) {
throw AuthExpiredException(e);
} catch (e) {
if (_isAuthError(e)) throw AuthExpiredException(e);
rethrow;
}
}