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

cdl-websql

v0.0.3

Published

This is simple Web sql packege which can be used to store information in the form of tables. You can use this packege instead of localStorage or sessionStorage.

Downloads

4

Readme

Web SQL

This is simple Web sql packege which can be used to store information in the form of tables. You can use this packege instead of localStorage or sessionStorage.

Installation instruction

Please follow below steps to utilize functions of indexed db.

Step-1 npm install rxjs --save
Step-2 npm install cdl-websql --save

Instruction to use the package

How to use?

Please follow below instruction to implement web sql in your angular application.

// In your component ts file

import { WebsqlService } from 'cdl-websql';

First way to utilize service

// Extend the service to utilize its functions

export class AppComponent extends WebsqlService {

    constructor() {
        super();
    }

    ngOnInit() {

        // Give web sql Database Name
        this.setDBName('DatabaseName');

        // Create web sql databse
        this.createDB().subscribe( result => {
            console.log('createDB', result);
        });

        // Create table. Here you can create multiple tables under single database
        this.createTable('TableName').subscribe( result => {
            console.log('createTable', result);
        });

        // Insert record to the table. Here you can also insert json string.
        this.insert('TableName', 'Value to insert').subscribe( result => {
            console.log('insert', result);
        });

        // Update record to the table by id.
        // params TableName --> Name of table
        // params id --> Id of which record updated.
        // params value --> value of which record want to update.
        this.update('TableName', id, 'Value to update').subscribe( result => {
            console.log('updateById', result);
        });

        // Delete record from table by id.
        // params TableName --> Name of table
        // params id --> Id of which record delete.
        this.delete('TableName', id).subscribe( result => {
            console.log('deleteById', result);
        });

        // Get record from table by id.
        // params TableName --> Name of table
        // params id --> Id of which record fetch.
        this.getById('TableName', id).subscribe( result => {
            console.log('getAll', result);
        });

        // Get all records from table
        this.getAll('TableName').subscribe( result => {
            console.log('getAll', result);
        });

        // You can write any sql statement to execute.
        // let sql = 'SELECT * FROM TableName where city = "Pune" ';
        // let sql = 'CREATE TABLE USER (userId integer primary key, name text,
                        city text, state text, country text)';
        // let sql = 'INSERT INTO USER (name, city, state, country) VALUES
                     ("Ritesh", "Anand", "Gujarat", "India")'
        // let sql = "DROP TABLE USER"
        this.executeQuery(sql).subscribe( result => {
            console.log('executeQuery ', result);
        });
    }
}

Second way to utilize service

// Initilize the service to the constructor

export class AppComponent {

    constructor(private websqlService: WebsqlService) {
        //TODO:
    }

    ngOnInit() {

        // Give web sql Database Name
        this.websqlService.setDBName('DatabaseName');

        // Create web sql databse
        this.websqlService.createDB().subscribe( result => {
            console.log('createDB', result);
        });

        // Create table. Here you can create multiple tables under single database
        this.websqlService.createTable('TableName').subscribe( result => {
            console.log('createTable', result);
        });

        // Insert record to the table. Here you can also insert json string.
        this.websqlService.insert('TableName', 'Value to insert').subscribe( result => {
            console.log('insert', result);
        });

        // Update record to the table by id.
        // params TableName --> Name of table
        // params id --> Id of which record updated.
        // params value --> value of which record want to update.
        this.websqlService.update('TableName', id, 'Value to update').subscribe( result => {
            console.log('updateById', result);
        });

        // Delete record from table by id.
        // params TableName --> Name of table
        // params id --> Id of which record delete.
        this.websqlService.delete('TableName', id).subscribe( result => {
            console.log('deleteById', result);
        });

        // Get record from table by id.
        // params TableName --> Name of table
        // params id --> Id of which record fetch.
        this.websqlService.getById('TableName', id).subscribe( result => {
            console.log('getAll', result);
        });

        // Get all records from table
        this.websqlService.getAll('TableName').subscribe( result => {
            console.log('getAll', result);
        });

        // You can write any sql statement to execute.
        // let sql = 'SELECT * FROM TableName where city = "Pune" ';
        // let sql = 'CREATE TABLE USER (userId integer primary key, name text,
                        city text, state text, country text)';
        // let sql = 'INSERT INTO USER (name, city, state, country) VALUES
                     ("Ritesh", "Anand", "Gujarat", "India")'
        // let sql = "DROP TABLE doctors"
        this.websqlService.executeQuery(sql).subscribe( result => {
            console.log('executeQuery ', result);
        });
    }
}