Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/amazingandyyy/levelize

Better leveldb usage.
https://github.com/amazingandyyy/levelize

database level leveldb nosql scratchese

Last synced: 19 days ago
JSON representation

Better leveldb usage.

Awesome Lists containing this project

README

        


🎁 levelize



Use leveldb just like mongo.











> open source!

## Installation

```shell
$ npm i --save @amazingandyyy/levelize
# or
$ yarn add @amazingandyyy/levelize
```

## Usage

```javascript
const process = require('process')
const level = require('level')
const Levelize = require('@amazingandyyy/levelize')

const levelize = new Levelize(level)

levelize.connect('levelize-demo-2019', {
location: process.cwd()
})

const UserShema = levelize.schema({
username: String,
password: String,
email: String
})

const userModel = levelize.model('User', UserShema)

for (let i = 0; i < 10; i++) {
userModel.createOne({
username: `amazingandyyy-${i}@gmail.com`, password: `xx${i}xx`
})
}
userModel.getAll()

userModel.getOne({
username: `[email protected]`
}, (err, user) => {
console.log(err, user)
})

```

## License

MIT