Zum Inhalt springen

Getting Started

GitHub

Sie können unsere AI-gestützte Einrichtung verwenden, um das Plugin zu installieren. Fügen Sie den Capgo-Fähigkeiten Ihrer AI-Werkzeug mit dem folgenden Befehl hinzu:

Terminal-Fenster
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

Verwenden Sie dann den folgenden Prompt:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-data-storage-sqlite` plugin in my project.

Wenn Sie die manuelle Einrichtung bevorzugen, installieren Sie das Plugin, indem Sie die folgenden Befehle ausführen und folgen Sie den unten angegebenen Plattform-spezifischen Anweisungen:

Terminal-Fenster
bun add @capgo/capacitor-data-storage-sqlite
bunx cap sync

Import

Import
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';

API Übersicht

API Übersicht

Ein Laden öffnen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({} as capOpenStorageOptions);

Laden schließen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.closeStore({} as capStorageOptions);

Überprüfen, ob der Store geöffnet ist

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreOpen({} as capStorageOptions);

Überprüfen, ob der Store existiert

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreExists({} as capStorageOptions);

Ein Store löschen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteStore({} as capOpenStorageOptions);

Eine Tabelle in einem bestehenden Store setzen oder hinzufügen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.setTable({} as capTableStorageOptions);

Speichern Sie ein Datenpaar mit gegebener Schlüssel und Wert

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.set({} as capDataStorageOptions);

Abrufen Sie einen Datenwert für einen gegebenen Daten-Schlüssel

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.get({} as capDataStorageOptions);

Löschen Sie ein Datenpaar mit gegebener Schlüssel

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.remove({} as capDataStorageOptions);

Datenspeicher löschen (alle Schlüssel entfernen)

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.clear();

Überprüfen Sie, ob eine Daten-Schlüssel existiert

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.iskey({} as capDataStorageOptions);

Liste der Daten-Schlüssel abrufen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keys();

Liste der Daten-Werte abrufen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.values();

Liste der Daten-Werte für Filter-Schlüssel abrufen

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.filtervalues({} as capFilterStorageOptions);

Holen Sie sich die Daten Schlüssel/Wert-Liste

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keysvalues();

Überprüfen Sie, ob eine Tabelle existiert

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isTable({} as capTableStorageOptions);

Holen Sie sich die Liste der Tabelle für den aktuellen Speicherort

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.tables();

Löschen Sie eine Tabelle

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteTable({} as capTableStorageOptions);

Datenbank importieren aus einem JSON

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.importFromJson({} as capStoreImportOptions);

Überprüfen Sie die Gültigkeit eines JSON-Objekts

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isJsonValid({} as capStoreImportOptions);

Exportieren Sie die gegebene Datenbank als JSON-Objekt

import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.exportToJson();
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
}
export interface capStorageOptions {
/**
* The storage name
*/
database: string;
}
export interface capDataStorageResult {
/**
* result set to true when successful else false
*/
result?: boolean;
/**
* a returned message
*/
message?: string;
}
export interface capTableStorageOptions {
/**
* The storage table name
*/
table: string;
}
export interface capDataStorageOptions {
/**
* The data name
*/
key: string;
/**
* The data value when required
*/
value?: string;
}
export interface capValueResult {
/**
* the data value for a given data key
*/
value: string;
}
export interface capKeysResult {
/**
* the data key list as an Array
*/
keys: string[];
}
export interface capValuesResult {
/**
* the data values list as an Array
*/
values: string[];
}
export interface capFilterStorageOptions {
/**
* The filter data for filtering keys
*
* ['%filter', 'filter', 'filter%'] for
* [starts with filter, contains filter, ends with filter]
*/
filter: string;
}
export interface capKeysValuesResult {
/**
* the data keys/values list as an Array of {key:string,value:string}
*/
keysvalues: any[];
}
export interface capTablesResult {
/**
* the tables list as an Array
*/
tables: string[];
}
export interface capStoreImportOptions {
/**
* Set the JSON object to import
*
*/
jsonstring?: string;
}

Diese Seite wurde aus dem Plugin generiert. src/definitions.ts. Wiederholen Sie die Synchronisierung, wenn die öffentliche API upstream geändert wird.

Wenn Sie Cloudflare verwenden Getting Started um Speicher und Dateihandling zu planen, verbinden Sie es mit Using @capgo/capacitor-data-storage-sqlite für die native Fähigkeit in Using @capgo/capacitor-data-storage-sqlite Using @capgo/capacitor-data-storage-sqlite für die Implementierungsdetails in @capgo/capacitor-data-storage-sqlite Using @capgo/capacitor-file für die Implementierungsdetails im @capgo/capacitor-Datei, Mit @capgo/capacitor-Datei für die native Fähigkeit in Mit @capgo/capacitor-Datei, und @capgo/capacitor-Uploader für die Implementierungsdetails in @capgo/capacitor-Uploader.