1.0.5 • Published 3 years ago

knex-cordova-sqlite v1.0.5

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

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
}
1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago