__CAPGO_KEEP_0__
__CAPGO_KEEP_4__
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_KEEP_11__
설치란 제목Capgo AI 도구에 다음 명령어를 사용하여 플러그인을 설치할 수 있습니다.
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
제목 "연결 해제"데이터베이스 연결을 종료하고 HTTP 서버를 중지합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.disconnect({ database: 'myapp' });getServerInfo
제목 "서버 정보 가져오기"직접 통신을 위한 HTTP 서버 포트와 토큰을 가져옵니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
const info = await CapgoCapacitorFastSql.getServerInfo({ database: 'myapp' });console.log('Server port:', info.port);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 섹션데이터베이스 트랜잭션을 시작합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.beginTransaction({ database: 'myapp' });// Execute multiple operationsawait CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });commitTransaction
commitTransaction 섹션현재 트랜잭션을 커밋합니다.
import { CapgoCapacitorFastSql } from '@capgo/capacitor-fast-sql';
await CapgoCapacitorFastSql.commitTransaction({ database: 'myapp' });rollbackTransaction
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 섹션__CAPGO_KEEP_0__을 위한 웹 특정 옵션을 구성합니다.
__CAPGO_KEEP_1__를 호출하세요. __CAPGO_KEEP_2__ __CAPGO_KEEP_3__에 대한 __CAPGO_KEEP_1__ 호출 전에 sql.js를 로컬로 번들링된 경로 대신 기본 CDN에서 로드하기 위해 sql.js WASM 모듈을 사용합니다. connect() __CAPGO_KEEP_1__는 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' });__CAPGO_KEEP_5__
__CAPGO_KEEP_6__SQLConnectionOptions
__CAPGO_KEEP_7____CAPGO_KEEP_8__를 위한 데이터베이스 연결 옵션입니다.
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
__CAPGO_KEEP_9__플러그인이 지원하는 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 모듈의 웹 플랫폼 구성. sql.js를 로컬로 패키징된 경로에서 로드하기 위해 사용하세요. configureWeb() __CAPGO_KEEP_0__
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 result - values indexed by column name.
export interface SQLRow { [column: string]: SQLValue;}실질적인 데이터 원천
Section titled “실질적인 데이터 원천”이 페이지는 플러그인의 src/definitions.ts업스트림에서 pubic API이 변경될 때 다시 싱크를 실행하세요.
Getting Started
Section titled “Getting Started”Capgo를 사용 중이라면 Getting Started 계획화된 대시보드 및 API 연산을 위해 연결하세요. Using @capgo/capacitor-fast-sql for the native capability in Using @capgo/capacitor-fast-sql, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.