시작하기
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
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.
설치
설치 섹션 제목Capgo의 AI-assisted 설치를 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 기능을 추가하려면 다음 명령어를 사용하세요.
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins다음 명령어를 사용하여 AI 도구에 기능을 추가하세요.
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
__CAPGO_KEEP_0__ 개요 제목연결 해제
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.disconnect({ database: 'myapp' });getServerInfo
__CAPGO_KEEP_0__ 복사__CAPGO_KEEP_0__ 개요 제목
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
const info = await CapgoCapacitorFastSql.getServerInfo({ database: 'myapp' });console.log('Server port:', info.port);execute
Section titled “execute”Execute a SQL query via Capacitor bridge (for simple queries). For better performance with large datasets, use the HTTP protocol directly via SQLConnection class.
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
Copy to clipboardSection titled “beginTransaction”
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.beginTransaction({ database: 'myapp' });// Execute multiple operationsawait CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });commitTransaction
Copy to clipboardSection titled “commitTransaction”
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });rollbackTransaction
Copy to clipboardSection titled “rollbackTransaction”
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
configureWeb웹 관련 옵션을 sql.js WASM 모듈에 구성합니다.
이 메서드를 이전 첫 connect() 로컬로 패키징된 경로 대신 기본 CDN에서 sql.js를 로드하는 첫 번째 호출 전에 호출하세요. 이 메서드는 iOS 및 Android에서 무시됩니다.
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데이터베이스 연결 옵션.
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
SQLValue플러그인이 지원하는 SQL 값 유형입니다.
export type SQLValue = string | number | boolean | null | Uint8Array;SQLResult
SQLResultSQL 쿼리 실행 결과입니다.
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
IsolationLevel트랜잭션 격리 수준입니다.
export enum IsolationLevel { ReadUncommitted = 'READ UNCOMMITTED', ReadCommitted = 'READ COMMITTED', RepeatableRead = 'REPEATABLE READ', Serializable = 'SERIALIZABLE',}WebConfig
WebConfigsql.js WASM 모듈의 웹 플랫폼 설정입니다. configureWeb() 로 로컬로 패키징된 경로에서 sql.js를 로드하는 대신 기본 CDN을 사용합니다.
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
SQLRowSQL row 결과 - 열 이름에 색인된 값
export interface SQLRow { [column: string]: SQLValue;}진리 근원
진리 근원이 페이지는 플러그인의 src/definitions.ts공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속
Getting Started에서 계속Capacitor를 사용 중이라면 Getting Started 대시보드와 API 운영을 계획하고 연결하세요. Using @capgo/capacitor-fast-sql Using @capgo/capacitor-fast-sql API 개요 API 개요 소개 소개 API 키 API 키 기기 기기