Needlessly Promiscuous, Modularize!

    klausdb

    1.0.1 • Public • Published

    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

    Keywords

    none

    Install

    npm i klausdb

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    Apache-2.0

    Unpacked Size

    18.4 kB

    Total Files

    6

    Last publish

    Collaborators

    • auditive_jax