Created
July 14, 2023 19:23
-
-
Save calebergh/c31c8b0e9fca04fe8da2914f8c03a221 to your computer and use it in GitHub Desktop.
nativescript-sqlite types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on official docs: https://github.com/NathanaelA/nativescript-sqlite/blob/master/src/README.md | |
interface SQLLite { | |
isOpen: () => boolean; | |
isSqlite: (db: any) => boolean; | |
exists: (dbName: string) => boolean; | |
deleteDatabase: (dbName: string) => boolean; | |
copyDatabase: (dbName: string, destName: string) => boolean; | |
version: (version?: number) => Promise<number>; | |
close: () => Promise<any>; | |
execSQL: (sql: string, params?: Array<string | number | null>, cb?: () => {}) => Promise<number>; | |
get: <T extends DBRecord>(sql: string, params?: Array<string | number | null>, cb?: () => {}) => Promise<[T]>; | |
all: <T extends DBRecord>(sql: string, params?: Array<string | number | null>, cb?: () => {}) => Promise<Array<T>>; | |
each: <T extends DBRecord>(sql: string, params?: Array<string | number | null>, cb?: (err, row) => {/* iterates per row */}) => Promise<number>; | |
// set the result type - see constants such as RESULTSASOBJECT | |
resultType: (number) => {}; | |
// set the result type - see constants such as VALUESARESTRING | |
valueType: (number) => {}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment