NexaDBLite
NexaDBLite adalah storage berbasis SQLite untuk React Native (native runtime).
Platform support
- Direkomendasikan untuk Android/iOS (native).
- Web tidak didukung untuk SQLite ini.
- Untuk web, gunakan modul
NexaDb/ IndexDB sesuai dokumentasi.
Contoh dasar
import { NexaDBLite } from "NexaJS";
await NexaDBLite.set("users", {
id: "1",
name: "John Doe",
email: "john@example.com",
});
const user = await NexaDBLite.get("users", "1");
const users = await NexaDBLite.getAll("users");Operasi CRUD
await NexaDBLite.updateFields("users", "1", {
name: "Updated Name",
email: "new@email.com",
});
await NexaDBLite.delete("users", "1");
const result = await NexaDBLite.search("users", "john", ["name", "email"]);
const latest = await NexaDBLite.getLatest("users", 5);Utility
const info = NexaDBLite.getInfo();
console.log(info.dbName, info.version, info.availableStores);
await NexaDBLite.resetDatabase();Catatan penting
- Pastikan data memiliki field
idsebagai primary key. - Store dibuat otomatis saat pertama dipakai (auto mode).
- Tangani error dengan
try/catchsaat operasi database.