Getting Started
이 플러그인에 대한 설치 단계와 전체 마크다운 가이드를 포함한 설정 프롬프트 복사.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-fast-sql`
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/fast-sql/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 도움을 받는 설치를 사용하여 플러그인을 설치할 수 있습니다. 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-fast-sql` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요.
bun add @capgo/capacitor-fast-sqlbunx cap syncImport
Import라는 제목의 섹션import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';API 개요
API 개요라는 제목의 섹션connect
연결이라는 제목의 섹션데이터베이스 연결을 초기화하고 HTTP 서버를 시작합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
const conn = await CapgoCapacitorFastSql.connect({ database: 'myapp' });console.log('Connected on port:', conn.port);disconnect
‘disconnect’라는 제목의 섹션데이터베이스 연결을 종료하고 HTTP 서버를 중지합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.disconnect({ database: 'myapp' });getServerInfo
‘getServerInfo’라는 제목의 섹션직접 통신을 위한 HTTP 서버 포트와 토큰을 가져옵니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
const info = await CapgoCapacitorFastSql.getServerInfo({ database: 'myapp' });console.log('Server port:', info.port);execute
‘execute’라는 제목의 섹션Capacitor 브릿지(단순 쿼리용)로 SQL 쿼리를 실행합니다. 대량 데이터셋과 함께 성능을 개선하려면 HTTP 프로토콜을 직접 사용하는 SQLConnection 클래스를 사용하세요.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
const result = await CapgoCapacitorFastSql.execute({ database: 'myapp', statement: 'SELECT * FROM users WHERE age > ?', params: [18]});console.log('Rows:', result.rows);beginTransaction
‘beginTransaction’라는 제목의 섹션__CAPGO_KEEP_0__를 시작합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.beginTransaction({ database: 'myapp' });// Execute multiple operationsawait CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });commitTransaction
__CAPGO_KEEP_2____CAPGO_KEEP_0__를 커밋합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });rollbackTransaction
__CAPGO_KEEP_2____CAPGO_KEEP_3__를 취소합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
try { await CapgoCapacitorFastSql.beginTransaction({ database: 'myapp' }); // Operations... await CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });} catch (error) { await CapgoCapacitorFastSql.rollbackTransaction({ database: 'myapp' });}configureWeb
__CAPGO_KEEP_4____CAPGO_KEEP_5__를 위한 웹 특정 옵션을 구성합니다.
__CAPGO_KEEP_6__를 호출합니다. __CAPGO_KEEP_7__ __CAPGO_KEEP_0__을 로컬로 부유하는 경로 대신 기본 CDN에서 sql.js를 로드하는 첫 번째 호출입니다. 이 메서드는 iOS 및 Android에서 비어 있습니다. connect() __CAPGO_KEEP_0__을 클립보드에 복사
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
// Configure once at app startup (web only)await CapgoCapacitorFastSql.configureWeb({ sqlJsUrl: '/assets/sql-wasm.js', wasmUrl: '/assets/sql-wasm.wasm',});const db = await FastSQL.connect({ database: 'myapp' });타입 참조 섹션
SQLConnectionOptions 섹션SQLConnectionOptions
데이터베이스 연결 옵션입니다.__CAPGO_KEEP_0__을 클립보드에 복사
export interface SQLConnectionOptions { /** * Database name (file will be created in app data directory) */ database: string;
/** * Enable encryption (iOS/Android only) */ encrypted?: boolean;
/** * Encryption key (required if encrypted is true) */ encryptionKey?: string;
/** * Read-only mode */ readOnly?: boolean;}SQLValue
SQL 플러그인에서 지원하는 SQL 값 유형입니다.__CAPGO_KEEP_0__을 클립보드에 복사
export type SQLValue = string | number | boolean | null | Uint8Array;SQLResult
SQL 결과 유형입니다.SQL 쿼리 실행 결과.
export interface SQLResult { /** * Rows returned by the query (for SELECT statements) */ rows: SQLRow[];
/** * Number of rows affected by the query (for INSERT/UPDATE/DELETE) */ rowsAffected: number;
/** * ID of the last inserted row (for INSERT statements with auto-increment) */ insertId?: number;}IsolationLevel
분리 수준분리 수준.
export enum IsolationLevel { ReadUncommitted = 'READ UNCOMMITTED', ReadCommitted = 'READ COMMITTED', RepeatableRead = 'REPEATABLE READ', Serializable = 'SERIALIZABLE',}로컬로 패키징된 경로 대신 기본 CDN에서 sql.js를 로드하기 위해 사용하세요. configureWeb() 복사
export interface WebConfig { /** * URL to the sql.js JavaScript file (`sql-wasm.js`). * When omitted, the plugin loads from the cdnjs CDN. * @example '/assets/sql-wasm.js' */ sqlJsUrl?: string;
/** * URL to the sql.js WebAssembly binary (`sql-wasm.wasm`). * When omitted, the plugin loads from the cdnjs CDN. * @example '/assets/sql-wasm.wasm' */ wasmUrl?: string;}SQLRow
복사SQL 행 결과 - 열 이름에 따라 인덱싱된 값.
export interface SQLRow { [column: string]: SQLValue;}원본
원본이 페이지는 플러그인의 src/definitions.ts. 업스트림에서 API이 변경되었을 때 다시 싱크를 실행하세요.
시작부터 계속
시작부터 계속이 플러그인을 사용하시는 경우 시작 대시보드와 API를 계획하고 운영하기 위해 Using @capgo/capacitor-fast-sql Using @capgo/capacitor-fast-sql API 개요 API 구현 세부 정보에 대한 개요를 위해 소개 __CAPGO_KEEP_0__ 키에 대한 구현 세부 정보를 위해 API 키에 대한 구현 세부 정보를 위해 for the implementation detail in API Keys, and %s 구현 세부 정보에 대한 __CAPGO_KEEP_0__ 키에 대해