INNER CODE UNIT · TypeScript
vecVersion
margelo/react-native-nitro-sqlite · packages/react-native-nitro-sqlite-vec/src/index.ts:47
export function vecVersion(db: NitroSQLiteConnection): string {
return firstValue<string>(db, 'SELECT vec_version() AS value')
}
/** Check whether the version query succeeds on this connection.
* @param db Open NitroSQLite connection. The check runs synchronously.
* @returns `false` if the version query throws for any reason, including a closed connection.
*/
export function isVecAvailable(db: NitroSQLiteConnection): boolean {
try {
vecVersion(db)
return true
} catch {
return false
}
}
/** Create a `vec0` virtual table if it does not already exist.