npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lite-manager

v1.2.5

Published

lite-manager sqlite database manager

Downloads

87

Readme

lite-manager sqlite database manager

npm version npm downloads npm downloads install size

Now you no longer need to inform the model because the self model program now!

create a table

const lite = require("lite-manager")
const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
const table = sql.connect("tname", {
  name: {
    type: "TEXT"
  },
});

insert into a table

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   name: {
     type: "TEXT"
   },
 });
 table.create({
   name: "Hello World!"
 })

get all values

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   name: {
     type: "TEXT"
   },
 });
 table.getAll().then(data => {
   console.log(data)
 })

get values by id

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   name: {
     type: "TEXT"
   },
 });
 table.getById(1).then(data => {
   console.log(data)
 })

get one value

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   name: {
     type: "TEXT"
   },
 });
 table.getOne({name: "Hello!"}).then(data => {
   console.log(data)
 })

update value

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   name: {
     type: "TEXT"
   },
 });
 table.update({
   name: "Hello!"
 },{id: 1})

delete value

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   name: {
     type: "TEXT"
   },
 });
 table.delete({id: 1})

aditional

  • note you can also use :memory: database

add a base64 str

const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const table = sql.connect("tname", {
   file: {
     type: "TEXT",
   },
 });
 const liteTypes = lite.types
 table.create({
   file: liteTypes.base64("./example_img.png")
 })
  • note you can add anything in base64

tables value models

text

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const liteTypes = lite.types
 const table = sql.connect("tname", {
   file: {
     type: liteTypes.text()
   },
 });

real

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const liteTypes = lite.types
 const table = sql.connect("tname", {
   file: {
     type: liteTypes.real()
   },
 });

integer

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const liteTypes = lite.types
 const table = sql.connect("tname", {
   file: {
     type: liteTypes.integer()
   },
 });

blob

 const lite = require("lite-manager")
 const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
 const liteTypes = lite.types
 const table = sql.connect("tname", {
   file: {
     type: liteTypes.blob()
   },
 });

run query

 const lite = require("lite-manager")
 const liteRun = lite.run
 const Run = new liteRun(":memory:")
 Run.run(".show")
  • under development

options

getTypes

  • getTypes will define how you want to get the values
  • example 1
const lite = require("lite-manager")
const sql = new lite.lite("./tmp.db",{ getType: "promisse" } )
const liteTypes = lite.types
const table = sql.connect("tname", {
  file: {
    type: liteTypes.text()
  },
});
table.getAll().then(pr => console.log(pr))
  • you will use .then in the promise
  • example 2
const lite = require("lite-manager")
const sql = new lite.lite("./tmp.db",{ getType: "value" } )
const liteTypes = lite.types
const table = sql.connect("tname", {
  file: {
    type: liteTypes.text()
  },
});
var values = table.getAll()
console.log(values)
  • you will use a function in value
  • example 3
const lite = require("lite-manager")
const sql = new lite.lite("./tmp.db",{ getType: "callback" } )
const liteTypes = lite.types
const table = sql.connect("tname", {
  file: {
    type: liteTypes.text()
  },
});
table.getAll(data => {
  console.log(data)
})
  • you will use callback in this

the asynchronous mode

  • asynchronous mode works in a way that You can use multiple functions at the same time note that get used callbacks
  • example
 const lite = require("lite-manager")
 const sql = lite.sync("./tmp.db","table_name")
 
 sql.create({name:"Hello"})
    .update({name:"Hello World!"},{name:"Hello"})
    .delete({name:"Hello World!"})
    .getAll(cb => {
      console.log(cb) // { rows: [{name: "Test" }] , size: 1 }
    })
 
  • still in development

bye bye!