1.0.2 • Published 12 months ago
capacitor-sqlite-kysely v1.0.2
Kysely - Capacitor SQLite
Custom dialect for kysely to use together with capacitor sqlite.
Installation
Ensure that you have kysely, @capacitor-community/sqlite with capacitor-sqlite-kysely installed. 
npm install --save kysely @capacitor-community/sqlite capacitor-sqlite-kyselyyarn add kysely @capacitor-community/sqlite capacitor-sqlite-kyselypnpm install --save kysely
pnpm install --save @capacitor-community/sqlite
pnpm install --save capacitor-sqlite-kyselyPlease refer to @capacitor-community/sqlite as there is manual configuration necessary to run on the web for example.
Usage
import { Kysely } from 'kysely';
import CapacitorSQLiteKyselyDialect from 'capacitor-sqlite-kysely';
import { CapacitorSQLite, SQLiteConnection } from '@capacitor-community/sqlite';
export default new Kysely({
  dialect: new CapacitorSQLiteKyselyDialect(
    new SQLiteConnection(CapacitorSQLite),
    { name: 'database' }
  ),
});Configuration
interface CapacitorSQLiteKyselyConfig {
  /**
   * name of database
   *
   * @default database
   */
  name: string;
  /**
   * whether the database should be encrypted
   *
   * @default false
   */
  encryption: boolean;
  /**
   * whether the database should be encrypted
   *
   * @default 'no-encryption'
   * @modes "no-encryption", "encryption", "secret", "decryption", "newsecret", "wrongsecret"
   */
  mode: string;
  /**
   * @default 1
   */
  version: number;
  /**
   * whether use the database in read only mode
   *
   * @default false
   */
  readonly: boolean;
}For further readings please refer to @capacitor-community/sqlite.
Examples
License
MIT License, see LICENSE.