Open
Description
For common procedures (e.g. basic selects/inserts), the complexity of the current api can feel excessive. I propose we include an alternate api for simple use cases.
To use, get a Database
instance:
import sqlite from 'react-native-sqlite-storage/simple';
const db = await sqlite.open('bar.sqlite');
Then make calls on it:
class Database {
/**
* Get all results from the query.
*/
async all<T> (sql: string, params?: DataType[]): Promise<T[]>;
/**
* Close the database.
*/
async close (): Promise<void>;
/**
* Execute a statement.
*/
async exec (sql: string, params?: DataType[]): Promise<void>;
/**
* Get the first result from the query.
*/
async get<T> (sql: string, params?: DataType[]): Promise<?T>;
}
Thoughts? Suggestions?
See #336 for a potential implementation.
Metadata
Metadata
Assignees
Labels
No labels