시작하기
이 플러그인의 설치 단계와 전체 마크다운 가이드가 포함된 설정 프롬프트를 복사하세요.
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.
AI-Assisted Setup으로 플러그인을 설치할 수 있습니다. 다음 명령어로 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.수동 설정을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-data-storage-sqlitebunx cap sync가져오기
“Import” 섹션import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';빠른 시작
“빠른 시작” 섹션import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({ database: 'app', encrypted: true });await CapgoCapacitorDataStorageSqlite.set({ key: 'session', value: JSON.stringify(session) });const { value } = await CapgoCapacitorDataStorageSqlite.get({ key: 'session' });예시: 네임스페이스 테이블
섹션 제목 “예: 네임스페이스 테이블”await CapgoCapacitorDataStorageSqlite.setTable({ table: 'drafts' });await CapgoCapacitorDataStorageSqlite.set({ key: 'invoice-42', value: draftJson });자주 하는 실수
“흔한 실수” 섹션- 사용 전 열기: 모든 읽기 또는 쓰기 작업은 열린 스토어 핸들을 요구합니다.
- 암호화 범위: 암호화는 iOS 및 Android 네이티브 스토어에 적용되며, 웹 IndexedDB 경로에는 적용되지 않습니다.
- 로그아웃 시 닫기:
clear()및closeStore()공유 기기에서 오래된 데이터 문제를 방지합니다.
API 개요
“API 개요” 섹션openStore
“openStore” 섹션스토어 열기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.openStore({ database: 'database', table: 'table', encrypted: false, mode: 'encryption', autoVacuum: 'none',});closeStore
“closeStore” 섹션스토어 닫기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.closeStore({ database: 'database' });isStoreOpen
“isStoreOpen” 섹션스토어가 열려 있는지 확인
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isStoreOpen({ database: 'database' });console.log(result);isStoreExists
“isStoreExists” 섹션스토어가 존재하는지 확인
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isStoreExists({ database: 'database' });console.log(result);deleteStore
“deleteStore” 섹션스토어 삭제
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteStore({ database: 'database', table: 'table', encrypted: false, mode: 'encryption', autoVacuum: 'none',});setTable
“setTable” 섹션기존 스토어에 테이블 설정 또는 추가
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.setTable({ table: 'table' });set
“set” 섹션지정된 키와 값으로 데이터 저장
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.set({ key: 'key-123' });get
“get” 섹션지정된 데이터 키의 값 조회
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.get({ key: 'key-123' });console.log(result);remove
“remove” 섹션지정된 키의 데이터 삭제
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.remove({ key: 'key-123' });clear
“clear” 섹션데이터 스토어 초기화 (모든 키 삭제)
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.clear();iskey
“iskey” 섹션데이터 키 존재 여부 확인
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.iskey({ key: 'key-123' });console.log(result);keys
“keys” 섹션데이터 키 목록 가져오기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.keys();console.log(result);values
“values” 섹션데이터 값 목록 가져오기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.values();console.log(result);filtervalues
“filtervalues” 섹션필터 키에 대한 데이터 값 목록 가져오기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.filtervalues({ filter: 'filter' });console.log(result);keysvalues
“keysvalues” 섹션데이터 키/값 쌍 목록 가져오기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.keysvalues();console.log(result);isTable
“isTable” 섹션테이블 존재 여부 확인
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isTable({ table: 'table' });console.log(result);tables
“tables” 섹션현재 스토어의 테이블 목록 가져오기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.tables();console.log(result);deleteTable
“deleteTable” 섹션테이블 삭제
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
await CapgoCapacitorDataStorageSqlite.deleteTable({ table: 'table' });importFromJson
“importFromJson” 섹션JSON에서 데이터베이스 가져오기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.importFromJson({ jsonstring: 'jsonstring' });console.log(result);isJsonValid
“isJsonValid” 섹션JSON 객체의 유효성 확인
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.isJsonValid({ jsonstring: 'jsonstring' });console.log(result);exportToJson
“exportToJson” 섹션주어진 데이터베이스를 JSON Object로 내보내기
import { CapgoCapacitorDataStorageSqlite } from '@capgo/capacitor-data-storage-sqlite';
const result = await CapgoCapacitorDataStorageSqlite.exportToJson();console.log(result);타입 레퍼런스
“타입 참조” 섹션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;}Source of Truth
“Source Of Truth” 섹션이 페이지는 플러그인의 src/definitions.tsupstream에서 public API가 변경되면 sync를 다시 실행하세요.
시작하기 다음 단계
“Getting Started에서 계속하기” 섹션사용 중이라면 시작하기 저장 공간과 파일 처리를 계획하려면, 다음 항목과 연결하세요 @capgo/capacitor-data-storage-sqlite 사용하기 @capgo/capacitor-data-storage-sqlite 사용 시 네이티브 기능을 위해, @capgo/capacitor-data-storage-sqlite @capgo/capacitor-data-storage-sqlite의 구현 세부 사항은, @capgo/capacitor-file @capgo/capacitor-file의 구현 세부 사항은, @capgo/capacitor-file 사용하기 @capgo/capacitor-file 사용 시 네이티브 기능에 대해서는, 그리고 @capgo/capacitor-uploader @capgo/capacitor-uploader.의 구현 세부 사항에 대해서는