Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lite-model

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lite-model

:fairy: lite model for sqlite, mongodb like driver API. make life easy. :surfing_man:

  • 0.0.10
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

liteModel

:fairy: lite model for sqlite, mongodb like driver API. make life easy. :surfing_man:

get start

npm i lite-model or yarn add lite-model

Create a table

CREATE TABLE test.users (
  id INT PRIMARY KEY NOT NULL,
  name CHAR(50) NOT NULL,
  gender CHAR(10) CHECK(gender IN('male', 'female', 'unknown')) NOT NULL,
  mail CHAR(128) NOT NULL,
  age INT NOT NULL,
  createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updatedAt TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
);

insert data

const Model = require('lite-model');
const model = new Model('test.db', 'users');
model.insert({
  name: 'tom',
  gender: 'male',
  age: 30,
  mail: 'tommy@hello.cc',
});

model.insert({
  name: 'jerry',
  gender: 'female',
  age: 31,
  mail: 'jerry@world.cc',
});

update date:

const res = model.update({id: 1}, { name: 'Tommy'});
console.log(res);

query:

const res = model.findOne({ where: { id: 1 }});
console.log(res);

const users = model.find({
  where: { id: {$gte: 1 } },
  limit: 10,
  offset: 1,
  order: { age: 'desc' }
})
console.log(users);

delete

const res = model.findOne({ id: 1 });
console.log(res);

FAQs

Package last updated on 29 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc