1.1.0 • Published 1 year ago

atlas.db v1.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Version GithubStars Downloads Package Quality

atlas.db

  • This is a simple and powerful JSON local database library

Installation

  • Run this command for install atlas.db.
npm i atlas.db

Usage

Javascript

JavaScript Example

const Atlas = require('atlas.db');

const Database = Atlas.Database.getInstance();

const UsersStructure = new Atlas.Structure({ id: { type: String }, coins: { type: Number, default: 0 } }); const Users = Database.createTable('users', UsersStructure);

const user = Users.get('drezzy') || Users.create({ id: 'drezzy'})

if(user){ user.coins = 2000; user.save(); }

user // { id: 'drezzy', coins: 2000 } user.omit('coins') // { id: 'drezzy' } user.pick('coins') // { coins: 2000 }

## Typescript
> Typescript Example
```ts
import * as Atlas from 'atlas.db';

interface IUser {
  id: string, 
  coins?: number
}

const Database = Atlas.Database.getInstance();

const UsersStructure = new Atlas.Structure<IUser>({
  id: { type: String },
  coins: { type: Number, default: 0 }
});
const Users = Database.createTable<IUser>('users', UsersStructure);

const user = Users.get('drezzy') || Users.create({ id: 'drezzy'})

if(user){
  user.coins = 2000;
  user.save();
}

user // { id: 'drezzy', coins: 2000 }
user.omit('coins') // { id: 'drezzy' }
user.pick('coins') // { coins: 2000 }
1.1.0

1 year 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