1.0.10 • Published 7 months ago

json-database-db v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

This library allows you to easily create an local database in JSON format. github: https://github.com/DiegoBreeg/json-db.git

$ npm i json-database-db

Import or require the library to your code

const { Model } = require('json-database-db')
import { Model } from 'json-database-db'

Use the Model class to instantiate an object capable of manipulating the database Model class require 2 arguments -Collection/Database name: string with Collection name. -schema: an object with key names and the types of their values.

ObjectValidator.validate(dummy: any, rule: any): boolean
const { Model } = require('json-database-db')

const schema = {
    name: { type: String, unique: false },
    LastName: { type: String, unique: false }

}

const Users = new Model('Books', schema)
Users.Save({name: 'Jhoe', LastName: 'Doe'})
Users.FindAll()

schema also accepts Arrays and Objects.

const { Model } = require('json-database-db')

const Users = new Model('Users', {
    name: { type: String },
    age: { type: Number },
    hobbie: { type: [] },
    skills: { type: {} }
})

Users.Save({
    name: 'joe',
    age: 27,
    hobbie: ['programin', 'read books'],
    skills: { smart: 'true' } })
1.0.9

7 months ago

1.0.10

7 months ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago