Skip to content

inf3cti0n95/rx-sql

Repository files navigation

rx-sql

Build Status

RxJS Implementation of MySQL

import { RxSQL } from "rx-sql";
import { createConnection } from "mysql";
import { flatMap } from "rxjs/operators";

let db = createConnection({
  host: "localhost",
  database: "database",
  user: "root",
  password: "password"
});

let rxsql$ = new RxSQL(db);

rxsql$
  .query("SELECT * FROM table")
  .pipe(flatMap(result => result))
  .subscribe(
      result => console.log(result),
      error => console.error(error)
      () => console.info("Completed!")
      );