2.0.2 • Published 2 years ago

depeche v2.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
2 years ago

Depeche

Fast models.

This is a package used for my personal projects. It has grown over time, and it made sense to release it as a module.

Usage

$ npm install --save depeche

file.js:

const Depeche = require('depeche');

function Model ( ) {
  this._table = 'model';
  this._primary = 'id';
  this._fields = [
    'id',
    'some_field',
    'some_other_field',
    'created_date'
  ];

  Depeche.model.extend(this, Model);
}

const model = new Model();

Configuration

Configuration occurs once, and is used for all database activity after configuration.

const Depeche = require('depeche');

Depeche.db.config({
  username: 'username',
  password: 'password',
  hostname: 'hostname',
  password: 'password'
});

Insert

const model = new Model();

model.some_field = 'Hello';
model.some_other_fields = 'World';

const rows - await model.insert();

Query

const model = new Model();

model.where('some_field').eq('Hello');

const rows = await model.all();
console.log(`Found ${rows.length} rows`);
2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.13

4 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago