New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tru_sqlite

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tru_sqlite

node sqlite manager

latest
Source
npmnpm
Version
1.0.8
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

tru_sqlite

Manage sqlite databases with node.js

Usage

Import the package

const Sqlite = require('tru_sqlite')({});
  • Create a new database
Sqlite.createDatabase({
    dbPath: <yourDbPath>,
    onSuccess: () => {},
    onError: err => {}
});
  • Add a table
Sqlite.createTable({
    dbPath: <yourDbPath>,
    name: 'users',
    cols: [
        {key: 'id', type: 'INT'},
        {key: 'email', type: 'VARCHAR(30)'},
        {key: 'password', type: 'VARCHAR(20)'},
        {key: 'grade', type: 'INT'},
        {key: 'token', type: 'VARCHAR(50)'}
    ],
    onSuccess: () => {},
    onError: err => {}
});
  • Get table schema
Sqlite.tableInfo({
    dbPath: <yourDbPath>,
    table: 'users',
    onSuccess: results => {},
    onError: err => {}
});
  • Run CRUD queries
Sqlite.query({
    dbPath: <yourDbPath>,
    sql: 'SELECT * FROM users',
    onSuccess: results => {},
    onError: err => {}
});
Sqlite.query({
    dbPath: <yourDbPath>,
    sql: 'INSERT INTO users VALUES (NULL, :email, :password, :grade, :token)',
    args: {
        email: 'thomas.rudrauf@gmail.com',
        password: 'abc123efg',
        grade: 1,
        token: 'eyAiaXNzIjogImVraW5vLmNvbSIsICJuYW1lIjogIkpvaG4gRG9lIiwgImFkbWluIjogdHJ1ZSB9'
    },
    onSuccess: results => {},
    onError: err => {}
});
Sqlite.query({
    dbPath: <yourDbPath>,
    sql: 'UPDATE users SET grade = :grade WHERE id = :id',
    args: {
        grade: 2,
        id: 1
    },
    onSuccess: results => {},
    onError: err => {}
});
Sqlite.query({
    dbPath: <yourDbPath>,
    sql: 'DELETE FROM users WHERE email = :email',
    args: {
        email: 'thomas.rudrauf@gmail.com',
    },
    onSuccess: results => {},
    onError: err => {}
});

Keywords

sqlite

FAQs

Package last updated on 07 Nov 2018

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