Socket
Socket
Sign inDemoInstall

knex-cordova-sqlite

Package Overview
Dependencies
25
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    knex-cordova-sqlite

A driver or dialect for using knex with a Cordova or PhoneGap app


Version published
Weekly downloads
0
Maintainers
1
Install size
2.90 MB
Created
Weekly downloads
 

Readme

Source

knex-cordova-sqlite

Allows you to use Knex inside a Cordova app.

Prerequisites

This library does not actually provide any bindings to sqlite, but instead connects the cordova-sqlite-storage provided API to Knex.

Therefore, you need to add the cordova-sqlite-storage plugin to your app.

Installation

npm install --save knex-cordova-sqlite

Example Usage

const knex = require('knex')({
  client: require('knex-cordova-sqlite'),
  connection: {
    filename: 'todos-' + Date.now() + '.db'
  }
});

async function init () {
  await knex.schema.createTable('todos', table => {
    table.increments('id');
    table.string('title');
  })
}

function addTodo (todo) {
  return knex('todos').insert(todo)
}

function getTodos () {
  return knex('todos').select('*')
}

module.exports = {
  init,
  addTodo,
  getTodos
}

Keywords

FAQs

Last updated on 21 Jun 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc