nano-react-native
v1.1.0
Published
Use nanoSQL in React Native
Downloads
4
Maintainers
Readme
Nano-React-Native
React Native Driver for nanoSQL
Documentation
This is an adapter written for NanoSQL that wraps React Native's built in AsyncStorage class, lets you use nanoSQL in your React Native projects with persistence to disk.
Installation
npm i --save nano-react-native
Usage
import { nSQL } from "nano-sql";
import { ReactNativeAdapter } from "nano-react-native";
nSQL("users")
.model([
{key: "id", type: "uuid", props: ["pk"]},
{key: "name", type: "string"}
])
.config({
mode: new ReactNativeAdapter() // required
}).connect().then(() => {
nSQL("users").query("upsert", {name: "Billy"}).exec().then(() => {
return nSQL("users").query("select").exec();
}).then((rows) => {
console.log(rows);
})
})
That's it, now everything nanoSQL can do you can do with React Native.
Read about nanoSQL here.