Démarrage Démarrage Getting Started
Copiez une commande de configuration avec les étapes d'installation et la guide markdown complète pour ce 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.
Installer
InstallationVous pouvez utiliser notre configuration assistée par l'IA pour installer le plugin. Ajoutez les Capgo compétences à votre outil IA en utilisant la commande suivante :
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsEnsuite, utilisez la prompt suivante :
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-data-storage-sqlite` plugin in my project.Si vous préférez la configuration manuelle, installez le plugin en exécutant les commandes suivantes et suivez les instructions spécifiques au plateforme ci-dessous :
bun add @capgo/capacitor-data-storage-sqlitebunx cap syncImporter
Section intitulée « Importer »import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';API Vue d'ensemble
Section intitulée “API Aperçu”openStore
Section intitulée “openStore”Ouvrir une boutique
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({} as capOpenStorageOptions);closeStore
Section intitulée “closeStore”Fermer la boutique
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.closeStore({} as capStorageOptions);isStoreOpen
Section intitulée “isStoreOpen”Vérifier si la boutique est ouverte
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreOpen({} as capStorageOptions);isStoreExists
Section intitulée “isStoreExists”Vérifier si la boutique existe
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreExists({} as capStorageOptions);deleteStore
Section intitulée “supprimer un magasin”Supprimer un magasin
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteStore({} as capOpenStorageOptions);Définir ou ajouter une table à un magasin existant
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.setTable({} as capTableStorageOptions);Stockez des données avec une clé et une valeur données
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.set({} as capDataStorageOptions);Récupérer une valeur de données pour une clé de données donnée
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.get({} as capDataStorageOptions);Supprimer un élément de données avec la clé donnée
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.remove({} as capDataStorageOptions);Effacer le magasin de données (supprimer toutes les clés)
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.clear();Vérifier si une clé de données existe
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.iskey({} as capDataStorageOptions);Obtenir la liste des clés de données
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keys();Obtenir la liste des valeurs de données
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.values();filtervalues
Section intitulée « valeurs de filtres »Obtenir la liste des valeurs de données pour les clés de filtres
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.filtervalues({} as capFilterStorageOptions);Obtenir la liste des paires clé/valeur de données
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keysvalues();Vérifier si une table existe
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isTable({} as capTableStorageOptions);Obtenir la liste des tables pour le magasin actuel
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.tables();deleteTable
Section intitulée « deleteTable »Supprimer une table
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteTable({} as capTableStorageOptions);importFromJson
Section intitulée « importer à partir de JSON »Importer une base de données à partir d'un fichier JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.importFromJson({} as capStoreImportOptions);isJsonValid
Section intitulée « est JSON valide »Vérifier la validité d'un objet JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isJsonValid({} as capStoreImportOptions);exportToJson
Section intitulée “exportToJson”Exporter la base de données donnée sous forme d'objet JSON
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.exportToJson();Référence de type
Section intitulée “Type Reference”capOpenStorageOptions
Section intitulée “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 intitulée “capStorageOptions”export interface capStorageOptions { /** * The storage name */ database: string;}capDataStorageResult
Section intitulée “capDataStorageResult”export interface capDataStorageResult { /** * result set to true when successful else false */ result?: boolean; /** * a returned message */ message?: string;}capTableStorageOptions
Section intitulée « options de stockage de tableau de cap »export interface capTableStorageOptions { /** * The storage table name */ table: string;}capDataStorageOptions
Section intitulée « options de stockage de données de cap »export interface capDataStorageOptions { /** * The data name */ key: string; /** * The data value when required */ value?: string;}capValueResult
Section intitulée « résultat de valeur de cap »export interface capValueResult { /** * the data value for a given data key */ value: string;}capKeysResult
Section intitulée « résultat de clés de cap »export interface capKeysResult { /** * the data key list as an Array */ keys: string[];}capValuesResult
Section intitulée « résultat de valeurs de cap »export interface capValuesResult { /** * the data values list as an Array */ values: string[];}capFilterStorageOptions
Section intitulée « options de stockage de filtre de cap »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 intitulée “capKeysValuesResult”export interface capKeysValuesResult { /** * the data keys/values list as an Array of {key:string,value:string} */ keysvalues: any[];}capTablesResult
Section intitulée “capTablesResult”export interface capTablesResult { /** * the tables list as an Array */ tables: string[];}capStoreImportOptions
Section intitulée “capStoreImportOptions”export interface capStoreImportOptions { /** * Set the JSON object to import * */ jsonstring?: string;}Source De Vérité
Section intitulée “Source De Vérité”Cette page est générée à partir du plugin’s src/definitions.tsRe-faire la synchronisation lorsque le public API change en amont.
Continuer depuis Getting Started
Section intitulée “Continuer depuis Getting Started”Si vous utilisez Démarrage pour planifier le stockage et la gestion des fichiers, connectez-le à Pour la capacité native dans @capgo/capacitor-data-storage-sqlite pour @capgo/capacitor-data-storage-sqlite pour le détail d'implémentation dans @capgo/capacitor-data-storage-sqlite pour le détail d'implémentation dans @capgo/capacitor-file Pour @capgo/capacitor-file pour la capacité native dans @capgo/capacitor-file, et pour @capgo/capacitor-uploader Si vous utilisez @capgo/capacitor-data-storage-sqlite Si vous utilisez @capgo/capacitor-file pour les détails d'implémentation dans @capgo/capacitor-uploader.