1.0.1 • Published 3 years ago
klausdb v1.0.1
Klaus is a modern, simple and fast library to use SQLite3 with the power of objects.
Installation 🔨
Grab Node.js from here, and then run in your console:
$ npm install klaus
Documentation ✨
Creating a table
const { Klaus } = require('klausdb')
const db = new Klaus('name_of_db')
db.table('mytable', {
schema: 'id TEXT, name TEXT'
})
Inserting into a table
const { Klaus } = require('klausdb')
const db = new Klaus('name_of_db')
db.table('mytable', {
schema: 'id TEXT, name TEXT'
})
db.insert({
table: 'mytable',
schema: 'id, name',
values: `'Hello', 'World'`
})
Selecting from a table
Without order by
const { Klaus } = require('klausdb')
const db = new Klaus('name_of_db')
db.table('mytable', {
schema: 'id TEXT, name TEXT'
})
let obj = db.select({
table: 'mytable',
key: 'id',
value: 'Hello',
get: 'id'
})
console.log(obj)
With order by
const { Klaus } = require('klausdb')
const db = new Klaus('name_of_db')
db.table('mytable', {
schema: 'id TEXT, name TEXT'
})
let obj = db.select({
table: 'mytable',
key: 'id',
value: 'Hello',
orderby: 'name',
get: 'id'
})
console.log(obj)
Updating a value in a table
const { Klaus } = require('klausdb')
const db = new Klaus('name_of_db')
db.table('mytable', {
schema: 'id TEXT, name TEXT'
})
db.update({
table: 'mytable',
key: 'id',
value: 'Goodbye'
})
Creator
This package has been created by Aidak#0002
Support
You can follow me on Twitter