Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
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.
Install
Section titled “Install”bun add @capgo/capacitor-data-storage-sqlitebunx cap syncImport
Section titled “Import”import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';API Overview
Section titled “API Overview”openStore
Section titled “openStore”Open a store
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({} as capOpenStorageOptions);closeStore
Section titled “closeStore”Close the Store
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.closeStore({} as capStorageOptions);isStoreOpen
Section titled “isStoreOpen”Check if the Store is opened
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreOpen({} as capStorageOptions);isStoreExists
Section titled “isStoreExists”Check if the Store exists
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreExists({} as capStorageOptions);deleteStore
Section titled “deleteStore”Delete a store
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteStore({} as capOpenStorageOptions);setTable
Section titled “setTable”Set or Add a table to an existing store
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.setTable({} as capTableStorageOptions);Store a data with given key and value
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.set({} as capDataStorageOptions);Retrieve a data value for a given data key
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.get({} as capDataStorageOptions);remove
Section titled “remove”Remove a data with given key
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.remove({} as capDataStorageOptions);Clear the Data Store (delete all keys)
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.clear();Check if a data key exists
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.iskey({} as capDataStorageOptions);Get the data key list
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keys();values
Section titled “values”Get the data value list
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.values();filtervalues
Section titled “filtervalues”Get the data value list for filter keys
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.filtervalues({} as capFilterStorageOptions);keysvalues
Section titled “keysvalues”Get the data key/value pair list
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keysvalues();isTable
Section titled “isTable”Check if a table exists
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isTable({} as capTableStorageOptions);tables
Section titled “tables”Get the table list for the current store
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.tables();deleteTable
Section titled “deleteTable”Delete a table
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteTable({} as capTableStorageOptions);importFromJson
Section titled “importFromJson”Import a database From a JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.importFromJson({} as capStoreImportOptions);isJsonValid
Section titled “isJsonValid”Check the validity of a JSON Object
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isJsonValid({} as capStoreImportOptions);exportToJson
Section titled “exportToJson”Export the given database to a JSON Object
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.exportToJson();Type Reference
Section titled “Type Reference”capOpenStorageOptions
Section titled “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
Section titled “capStorageOptions”export interface capStorageOptions { /** * The storage name */ database: string;}capDataStorageResult
Section titled “capDataStorageResult”export interface capDataStorageResult { /** * result set to true when successful else false */ result?: boolean; /** * a returned message */ message?: string;}capTableStorageOptions
Section titled “capTableStorageOptions”export interface capTableStorageOptions { /** * The storage table name */ table: string;}capDataStorageOptions
Section titled “capDataStorageOptions”export interface capDataStorageOptions { /** * The data name */ key: string; /** * The data value when required */ value?: string;}capValueResult
Section titled “capValueResult”export interface capValueResult { /** * the data value for a given data key */ value: string;}capKeysResult
Section titled “capKeysResult”export interface capKeysResult { /** * the data key list as an Array */ keys: string[];}capValuesResult
Section titled “capValuesResult”export interface capValuesResult { /** * the data values list as an Array */ values: string[];}capFilterStorageOptions
Section titled “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
Section titled “capKeysValuesResult”export interface capKeysValuesResult { /** * the data keys/values list as an Array of {key:string,value:string} */ keysvalues: any[];}capTablesResult
Section titled “capTablesResult”export interface capTablesResult { /** * the tables list as an Array */ tables: string[];}capStoreImportOptions
Section titled “capStoreImportOptions”export interface capStoreImportOptions { /** * Set the JSON object to import * */ jsonstring?: string;}Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.