はじめから始めよう
インストール手順とフルマークダウンガイドのセットアップの質問をコピーしてください。
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.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-data-storage-sqlite` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-data-storage-sqlitebunx cap syncインポート
「インポート」のセクションimport { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';API の概要
「API の概要」のセクションopenStore
「openStore」のセクションストアを開く
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({} as capOpenStorageOptions);closeStore
「closeStore」のセクションストアを閉じる
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.closeStore({} as capStorageOptions);isStoreOpen
Section titled “isStoreOpen”Storeが開いているかどうかを確認
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreOpen({} as capStorageOptions);isStoreExists
Section titled “isStoreExists”Storeが存在するかどうかを確認
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isStoreExists({} as capStorageOptions);deleteStore
Section titled “deleteStore”Storeを削除
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteStore({} as capOpenStorageOptions);setTable
Section titled “setTable”既存のStoreにテーブルを追加または設定
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.setTable({} as capTableStorageOptions);指定されたキーと値でデータを保存
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.set({} as capDataStorageOptions);指定されたデータキーに対してデータの値を取得
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.get({} as capDataStorageOptions);remove
セクションのタイトル “remove”指定されたキーでデータを削除
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.remove({} as capDataStorageOptions);clear
セクションのタイトル “clear”すべてのキーを削除してデータ ストアをクリア
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.clear();データキーが存在するか確認
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.iskey({} as capDataStorageOptions);データキーの一覧を取得
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keys();values
Section titled “values”データ値の一覧を取得
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.values();filtervalues
Section titled “filtervalues”フィルターキーに対応するデータ値の一覧を取得
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.filtervalues({} as capFilterStorageOptions);keysvalues
キー値リストデータのキー/値ペアリストを取得
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.keysvalues();isTable
セクション “isTable”テーブルの存在を確認
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isTable({} as capTableStorageOptions);tables
セクション “tables”現在のストアのテーブルリストを取得
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.tables();deleteTable
セクション “deleteTable”テーブルを削除
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteTable({} as capTableStorageOptions);importFromJson
importFromJsonセクションJSONからデータベースをインポートする
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.importFromJson({} as capStoreImportOptions);isJsonValid
isJsonValidセクションJSONオブジェクトの有効性を確認する
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.isJsonValid({} as capStoreImportOptions);exportToJson
exportToJsonセクション指定されたデータベースをJSONオブジェクトにエクスポートする
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.exportToJson();型参照
型参照セクションcapOpenStorageOptions
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
セクション「capStorageOptions」export interface capStorageOptions { /** * The storage name */ database: string;}capDataStorageResult
セクション「capDataStorageResult」export interface capDataStorageResult { /** * result set to true when successful else false */ result?: boolean; /** * a returned message */ message?: string;}capTableStorageOptions
セクション「capTableStorageOptions」export interface capTableStorageOptions { /** * The storage table name */ table: string;}capDataStorageOptions
セクション「capDataStorageOptions」export interface capDataStorageOptions { /** * The data name */ key: string; /** * The data value when required */ value?: string;}capValueResult
セクション「capValueResult」export interface capValueResult { /** * the data value for a given data key */ value: string;}capKeysResult
セクション「capKeysResult」export interface capKeysResult { /** * the data key list as an Array */ keys: string[];}capValuesResult
「capValuesResult」セクションexport interface capValuesResult { /** * the data values list as an Array */ values: string[];}capFilterStorageOptions
「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
「capKeysValuesResult」セクションexport interface capKeysValuesResult { /** * the data keys/values list as an Array of {key:string,value:string} */ keysvalues: any[];}capTablesResult
「capTablesResult」セクションexport interface capTablesResult { /** * the tables list as an Array */ tables: string[];}capStoreImportOptions
「capStoreImportOptions」セクションexport interface capStoreImportOptions { /** * Set the JSON object to import * */ jsonstring?: string;}真実の源
真実の源このページはプラグインから生成されています。 src/definitions.ts. upstream の API が変更されたときに、再度 Sync を実行してください。
Getting Started から続けてください。
Getting Started から続けてください。あなたが「 Getting Started を使用して、ストレージとファイルの管理を計画する場合、 @capgo/capacitor-data-storage-sqlite for the native capability in Using @capgo/capacitor-data-storage-sqlite, @capgo/capacitor-data-storage-sqlite for the implementation detail in @capgo/capacitor-data-storage-sqlite, @capgo/capacitor-file @capgo/capacitor-fileの実装詳細 @capgo/capacitor-fileを使用 @capgo/capacitor-fileを使用して、ネイティブ機能を実現 @capgo/capacitor-uploader @capgo/capacitor-uploaderの実装詳細