跳过主要内容
返回插件
@capgo/capacitor-data-storage-sqlite
教程
由 github.com/Cap-go

数据存储

Store data locally using SQLite database with simple key-value API and encryption support

指南

数据存储教程

使用@capgo/capacitor-data-storage-sqlite

SQLite键值对存储

安装

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

此插件暴露的内容

  • openStore - 打开一个存储。
  • closeStore - 关闭存储。
  • isStoreOpen - 检查存储是否打开。
  • isStoreExists - 检查是否存在 Store。

示例用途

openStore

打开一个 Store。

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

await CapgoCapacitorDataStorageSqlite.openStore({} as capOpenStorageOptions);

closeStore

关闭 Store。

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

await CapgoCapacitorDataStorageSqlite.closeStore({} as capStorageOptions);

isStoreOpen

检查 Store 是否已打开。

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

await CapgoCapacitorDataStorageSqlite.isStoreOpen({} as capStorageOptions);

isStoreExists

检查是否存在 Store。

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

await CapgoCapacitorDataStorageSqlite.isStoreExists({} as capStorageOptions);

全局参考