/** * 初始化数据库时的相关配置 * @param name 数据库名称 */ export type createSQLiteContextOptions = { /** * 数据库名称 */ name: string, } /** * 执行增删改等操作的SQL语句的相关配置 * @param sql SQL语句 * @param success 成功回调 * @param fail 失败回调 * @param complete 完成回调 */ export type executeSqlOptions = { /** * SQL语句 */ sql: string, /** * 执行增删改等操作的SQL语句的成功回调 */ success?: executeSqlOptionsSuccessCallback | null, /** * 执行增删改等操作的SQL语句的失败回调 */ fail?: executeSqlOptionsFailCallback | null, /** * 执行增删改等操作的SQL语句的完成回调 */ complete?: executeSqlOptionsCompleteCallback | null, } /** * 执行增删改等操作的SQL语句的成功回调 */ export type executeSqlOptionsSuccessCallback = (res: executeSqlOptionsResult) => void /** * 执行增删改等操作的SQL语句的失败回调 */ export type executeSqlOptionsFailCallback = (res: executeSqlOptionsResult) => void /** * 执行增删改等操作的SQL语句的完成回调 */ export type executeSqlOptionsCompleteCallback = (res: executeSqlOptionsResult) => void export type transactionResult = { errCode: number; errSubject?: string; cause?: any; errMsg: string; }; export type ICreateSQLiteContextError = { errCode: number; errSubject?: string; cause?: any; errMsg: string; }; export type executeSqlOptionsResult = { errCode: number; errSubject?: string; cause?: any; errMsg: string; data: boolean[]; } /** * 执行查询操作的SQL语句的相关配置 */ export type selectSqlOptions = { /** * SQL语句 */ sql: string, /** * 执行查询操作的SQL语句的成功回调 */ success?: selectSqlOptionsSuccessCallback | null, /** * 执行查询操作的SQL语句的失败回调 */ fail?: selectSqlOptionsFailCallback | null, /** * 执行查询操作的SQL语句的完成回调 */ complete?: selectSqlOptionsCompleteCallback | null, } /** * 执行查询操作的SQL语句的成功回调 */ export type selectSqlOptionsSuccessCallback = (res: selectSqlOptionsResult) => void /** * 执行查询操作的SQL语句的失败回调 */ export type selectSqlOptionsFailCallback = (res: selectSqlOptionsResult) => void /** * 执行查询操作的SQL语句的完成回调 */ export type selectSqlOptionsCompleteCallback = (res: selectSqlOptionsResult) => void export type selectSqlOptionsResult = { errCode: number; errSubject?: string; cause?: any; errMsg: string; data: string[][]; } export type transactionOptions = { transaction: transactionOperation; success?: (res: transactionResult) => void; fail?: (res: transactionResult) => void; complete?: (res: transactionResult) => void; } /** * 事务操作类型 * @param begin 开始事务 * @param commit 提交事务 * @param rollback 回滚事务 */ export type transactionOperation = 'begin' | 'commit' | 'rollback' /** * 事务执行的成功回调 */ export type transactionSuccessCallback = (res: transactionResult) => void /** * 事务执行的失败回调 */ export type transactionFailCallback = (res: transactionResult) => void /** * 事务执行的完成回调 */ export type transactionCompleteCallback = (res: transactionResult) => void