A wrapper library that adds RxJS 5 API to sqlite3
npm install rx-sqlite --save
or
yarn add rx-sqlite
import RxDatabase from "rx-sqlite";
import "rxjs";
let sql = `create table users (name text);
insert into users values ("john");
insert into users values ("bob");`;
let db = new RxDatabase(":memory:");
db.exec(sql)
.switchMap(() => db.each("select rowid, name from users"))
.subscribe(u => console.log(u));
Database Wrapper Object that adds RxJS 5 API to sqlite3
make new RxDatabase object and open Database.
Parameters
prepare SQL and bind parameters.
Parameters
sql
string SQL query string.params
...Array<any> see passing bind parameters
Returns RxStatement
Binds parameters and executes the query.
Parameters
sql
string SQL query string.params
...Array<any> see passing bind parameters
Returns Observable<T>
Binds parameters and executes the query and retrieves a row.
Parameters
sql
string SQL query string.params
...Array<any> see passing bind parameters
Returns Observable<T>
Binds parameters and executes the query and retrieves all rows at one time.
Parameters
sql
string SQL query string.params
...Array<any> see passing bind parameters
Returns Observable<Array<T>>
Binds parameters and executes the query and retrieves all rows.
Parameters
sql
string SQL query string.params
...Array<any> see passing bind parameters
Returns Observable<T>
executes the multiple query.
Parameters
sql
string
Returns Observable<void>
make new specified event stream.
Parameters
Returns Observable<Event>
Parameters
timeout
number milliseconds of sleeping time
close the Database.
you should call this method when you work done
The database is opened in read-only mode.
The database is opened for reading and writing if possible.
The database is opened for reading and writing, and is created if it does not already exist.
supported database opening flags
Type: (OPEN_READONLY | OPEN_READWRITE | OPEN_CREATE)
supported event names
Type: ("error"
| "open"
| "close"
| "profile"
| "trace"
)
Statement Wrapper Object that adds RxJS 5 API to sqlite3
make new error event stream.
Returns Observable<{error: Error}>
Binds parameters and executes the statement.
Parameters
params
...Array<any> see passing bind parameters
Returns Observable<T>
Binds parameters and executes the statement and retrieves a row.
Parameters
params
...Array<any> see passing bind parameters
Returns Observable<T>
Binds parameters and executes the statement and retrieves all rows at one time.
Parameters
params
...Array<any> see passing bind parameters
Returns Observable<Array<T>>
Binds parameters and executes the statement and retrieves all rows.
Parameters
params
...Array<any> see passing bind parameters
Returns Observable<T>
Binds parameters to the prepared statement
Parameters
params
...Array<any> see passing bind parameters
Returns Observable<RxStatement>
Returns Observable<RxStatement>
git clone https://github.com/taichi/rx-sqlite
yarn install
yarn setup
yarn build
Copyright 2017 taichi
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.