Mulai Menggunakan
Salin prompt pengaturan dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-data-storage-sqlite`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/data-storage-sqlite/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Instalasi
Bab berjudul “Instalasi”Anda dapat menggunakan Pengaturan Asisten AI kami untuk menginstal plugin. Tambahkan Capgo kemampuan ke alat AI Anda menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-data-storage-sqlite` plugin in my project.Jika Anda lebih suka Pengaturan Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi spesifik platform di bawah ini:
bun add @capgo/capacitor-data-storage-sqlitebunx cap syncImport
Bab berjudul “Import”import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';API Pengantar
Bab berjudul “API Pengantar”openStore
Bab berjudul “openStore”Buka Toko
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({ database: 'database', table: 'table', encrypted: false, mode: 'encryption', autoVacuum: 'none',});closeStore
Bab berjudul “closeStore”Close the Store
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.closeStore({ database: 'database' });isStoreOpen
Judul Bagian “isStoreOpen”Periksa apakah Toko sudah dibuka
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isStoreOpen({ database: 'database' });console.log(result);isStoreExists
Judul Bagian “isStoreExists”Periksa apakah Toko sudah ada
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isStoreExists({ database: 'database' });console.log(result);deleteStore
Judul Bagian “deleteStore”Hapus Toko
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteStore({ database: 'database', table: 'table', encrypted: false, mode: 'encryption', autoVacuum: 'none',});setTable
Judul Bagian “setTable”Atur atau Tambah tabel ke Toko yang sudah ada
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.setTable({ table: 'table' });Simpan data dengan kunci dan nilai yang diberikan
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.set({ key: 'key-123' });Ambil nilai data untuk kunci data yang diberikan
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.get({ key: 'key-123' });console.log(result);remove
Bagian berjudul “hapus”Hapus data dengan kunci yang diberikan
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.remove({ key: 'key-123' });Bersihkan Data Store (hapus semua kunci)
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.clear();iskey
Judul Bagian “iskey”Periksa apakah kunci data ada
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.iskey({ key: 'key-123' });console.log(result);Dapatkan daftar kunci data
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.keys();console.log(result);values
Judul Bagian “values”Dapatkan daftar nilai data
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.values();console.log(result);filtervalues
Judul Bagian “filtervalues”Dapatkan daftar nilai data untuk kunci filter
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.filtervalues({ filter: 'filter' });console.log(result);keysvalues
Judul Bagian “keysvalues”Dapatkan Daftar Kunci/Nilai
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.keysvalues();console.log(result);isTable
Judul Bagian “isTable”Periksa Jika Tabel Ada
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isTable({ table: 'table' });console.log(result);tables
Judul Bagian “tables”Dapatkan Daftar Tabel untuk Penyimpanan Saat Ini
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.tables();console.log(result);deleteTable
Judul Bagian “deleteTable”Hapus Tabel
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteTable({ table: 'table' });importFromJson
Judul Bagian “importFromJson”Import Basis Data Dari JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.importFromJson({ jsonstring: 'jsonstring' });console.log(result);isJsonValid
Judul Bagian “isJsonValid”Periksa Kelayakan Objek JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isJsonValid({ jsonstring: 'jsonstring' });console.log(result);exportToJson
Judul Bagian “exportToJson”Export Basis Data ke Objek JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.exportToJson();console.log(result);Referensi Tipe
Judul Bagian “Type Reference”capOpenStorageOptions
Judul Bagian “capOpenStorageOptions”export interface capOpenStorageOptions { /** * The storage database name */ database?: string; // default: // ios, android: storageSQLite // web : storageIDB /** * The storage table name */ table?: string; // default: // ios, android: storage_table // web: storage_store /** * Set to true for database encryption */ encrypted?: boolean; // only for ios and android /*** * Set the mode for database encryption * ["encryption", "secret","newsecret"] */ mode?: string; // only for ios and android}capStorageOptions
Bab berjudul “capStorageOptions”export interface capStorageOptions { /** * The storage name */ database: string;}capDataStorageResult
Bab berjudul “capDataStorageResult”export interface capDataStorageResult { /** * result set to true when successful else false */ result?: boolean; /** * a returned message */ message?: string;}capTableStorageOptions
Bab berjudul “capTableStorageOptions”export interface capTableStorageOptions { /** * The storage table name */ table: string;}capDataStorageOptions
Bab berjudul “capDataStorageOptions”export interface capDataStorageOptions { /** * The data name */ key: string; /** * The data value when required */ value?: string;}capValueResult
Bab berjudul “capValueResult”export interface capValueResult { /** * the data value for a given data key */ value: string;}capKeysResult
Bab berjudul “capKeysResult”export interface capKeysResult { /** * the data key list as an Array */ keys: string[];}capValuesResult
Bab berjudul “capValuesResult”export interface capValuesResult { /** * the data values list as an Array */ values: string[];}capFilterStorageOptions
Bab berjudul “capFilterStorageOptions”export interface capFilterStorageOptions { /** * The filter data for filtering keys * * ['%filter', 'filter', 'filter%'] for * [starts with filter, contains filter, ends with filter] */ filter: string;}capKeysValuesResult
Bab berjudul “capKeysValuesResult”export interface capKeysValuesResult { /** * the data keys/values list as an Array of {key:string,value:string} */ keysvalues: any[];}capTablesResult
Bab berjudul “capTablesResult”export interface capTablesResult { /** * the tables list as an Array */ tables: string[];}capStoreImportOptions
Bab berjudul “capStoreImportOptions”export interface capStoreImportOptions { /** * Set the JSON object to import * */ jsonstring?: string;}Sumber Kebenaran
Judul Bagian: Sumber KebenaranHalaman ini dihasilkan dari plugin’s src/definitions.tsRe-run sinkronisasi ketika API publik berubah di atas
Teruskan dari Getting Started
Judul Bagian: Teruskan dari Getting StartedJika Anda menggunakan Mulai Menggunakan untuk merencanakan penyimpanan dan pengelolaan file, hubungkannya dengan Menggunakan @capgo/capacitor-data-storage-sqlite Untuk kemampuan native di dalam Menggunakan @capgo/capacitor-data-storage-sqlite @capgo/capacitor-data-storage-sqlite Untuk detail implementasi di @capgo/capacitor-data-storage-sqlite file @capgo/capacitor untuk detail implementasi di file @capgo/capacitor Menggunakan file @capgo/capacitor untuk kemampuan native di Menggunakan file @capgo/capacitor, dan uploader @capgo/capacitor untuk detail implementasi di uploader @capgo/capacitor