sqlite_master.db
TypeScript icon, indicating that this package has built-in type declarations

7.0.1 • Public • Published

sqlite_master.db

Documentation can be found here.

Example

This is a small example of how you would create a database instance and a table with 2 columns with a primary column and a json column, connecting database and doing some operations with it.

const { Database, Column, Table } = require("sqlite_master.db")

const db = new Database({ path: "./db.sqlite" })

const table = db.createTable("mytable").addColumns([
    new Column()
    .setName("id")
    .setPrimary(true)
    .setType("TEXT"),
    new Column()
    .setName("json")
    .setType("JSON")
    .setDefault({})
])

db.once("ready", () => {
    console.log(`Database is ready!`)

    const changes = table.set({
        id: "12345",
        json: {
            swords: 1,
            hammers: 0
        }
    })

    console.log(changes)

    const results = table.get({
        where: {
            column: "id",
            equals: "12345"
        }
    })

    console.log(results)

    const deletion = table.delete({
        where: {
            column: "id",
            equals: "12345"
        }
    })

    console.log(deletion)

    const all = table.all()

    console.log(all)
})

db.connect()

Readme

Keywords

none

Package Sidebar

Install

npm i sqlite_master.db

Weekly Downloads

0

Version

7.0.1

License

ISC

Unpacked Size

728 kB

Total Files

58

Last publish

Collaborators

  • ruben40000