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

sqleye

v1.3.0

Published

A Fast in memory SQL abstraction (database)

Downloads

3

Readme

sqleye

Fast in memory database. Currenlty supports sqllite3


Overview

sqleye is a beautiful abstraction for sqllite3. Remember, Beauty lies in the eyes of the beholder. Anyone with an eye to use sqllite3 don't want to be bothered with the murky details behind.

sqleye is a fast and easy to use in memory database that uses sqllite3 in the background. This means developers don't need to write any DB code. Given the fact that database operations take time and are asynchronous. This module relieves users of those facts. Just use objects as you do in nodejs and they will automatically be synced to an sqllite3 database.

Currently works with sqllite3 only.

Features

Install

npm install sqleye

Require it in your code

var sqleye = require ('sqleye')

Creating objects.

To write a nodejs object to a database, Just call the constructor to outline the fields of the object. This is the schema.

// The first parameter lays out the object fields, Only text and int are currently supported for field types
// The second parameter is the primary key
// The third parameter specifies the database type, currently this is only 'sqllite'
// The fourth parameter is the name of your database.
var objStore = new sqleye ( { name: 'text', place: 'text', animal: 'text', pin: 'integer' },
                         [ 'name' ],
                         'sqllite',
                         'mydb' )

// Whenever you create an object with the above fields. just insert it.
var b = { name: 'James', place: 'Vancouver', animal: 'Tiger', pin: 1234 }
objStore.insert(b)

// To query 
objStore.query ([ 'James' ])

Using multiple fields as the primary key

// To have both the name and pin to be unique and used as the primary key, it's easy
// In the constructor, just provide parameter 2 as [ 'name', 'pin' ].
var objStore = new sqleye ( { name: 'text', place: 'text', animal: 'text', pin: 'integer' },
                         [ 'name', 'pin' ],
                         'sqllite',
                         'mydb' )
// This time query by both name and pin
objStore.query ( ['James', 1234] )

Turning off Database support.

sqleye also supports a plain in-memory object store without writing to any Database. To use this support, just provide 'mem' as the third parameter to the sqleye constructor. This is good for programs that don't need persistency but a real fast cache in memory to work with.

// Providing 'mem' as the third parameter disables all DB operations.
var objStore = new sqleye ( { name: 'text', place: 'text', animal: 'text', pin: 'integer' },
                         [ 'name', 'pin' ],
                         'mem',
                         'mydb' )