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

@webqit/objective-sql

v0.2.76

Published

The Succinct, fullstack SQL for modern web apps.

Downloads

54

Readme

Linked QL

The object-oriented, adaptive SQL client for modern apps - query anything from the plain JSON object, to the client-side IndexedDB, to the server-side DB.

Overview

Linked QL is a query client that wraps powerful concepts in a simple, succint API.

  1. It lets you query different types of databases using one consistent syntax and API.
    1. Both SQL databases (like MySQL, PostgreSQL) and client-side, non-SQL databases (like IndexedDB).
    2. One syntax and API to rule them all!
  2. It implements a superset of the SQL language that lets you access relationships without constructing JOINS.
    1. Goodbye query complexity!
    2. Goodbye ORMs!

Take a one-minute overview of Objective SQL.

Basic Usage

Obtain an Objective SQL query client for your target database:

  1. For SQL databases, import and instantiate the SQL language driver. (You'll pass in the name of an appropriate database connection driver that works for your database.)

    // Import SQL
    import { SQL } from '@webqit/objective-sql';
       
    // Using the 'mysql2' connector (npm install mysql2)
    const connectionDriver = 'mysql2';
    const connectionParams = {
        host: '127.0.0.1',
        user: 'root',
        password: '',
    };
    
    // Create an instance by calling .connect().
    const client = SQL.connect(connectionDriver, connectionParams);
       
    // Or by using the 'new' keyword.
    const client = new SQL(connectionDriver, connectionParams);
  2. For the client-side IndexedDB database, import and instantiate the IDB language driver.

    IndexedDB is a low-level API for client-side storage.

    // Import IDB
    import { IDB } from '@webqit/objective-sql';
       
    // Create an instance.
    const client = new IDB;
  3. To work with Objective SQL's in-memory object storage, import and instantiate the ODB language driver.

    This is an environment-agnostic in-memory store.

    // Import IDB
    import { ODB } from '@webqit/objective-sql';
       
    // Create an instance.
    const client = new ODB;

All client instances above implement the same interface:

  1. The client.query() method lets you run any SQL query on your database.

    // Run a query
    client.query('SELECT fname, lname FROM users').then(result => {
        console.log(result);
    });
  2. Other methods give us a programmatic way to manipulate or query the database. (Docs coming soon.)

    1. The client.createDatabase() and client.createDatabaseIfNotExists() methods. (Returning a Database instance (database).)
    2. The client.dropDatabase() and client.dropDatabaseIfExists() methods.
    3. The client.databases() method - for listing databases, and the client.database(name) method - for obtaining a Database instance (database).
    4. The database.createTable(), database.alterTable(), and database.dropTable() methods.
    5. The database.tables() method - for listing tables, the database.table(name) method - for obtaining a Table instance (table).
    6. The table.getAll() method - for listing entries, the table.get(id) method - for obtaining an entry, the table.count() method - for count.
    7. The table.addAll() and table.add() methods.
    8. The table.putAll() and table.put() methods.
    9. The table.deleteAll() and table.delete() methods.

Learn more about the API. (DOCS coming soon.)

What About Relationships? - The Language

Objective SQL is a superset of the same familiar, powerful SQL language you know...

SELECT post_title, users.fname AS author_name FROM posts
LEFT JOIN users ON users.id = posts.author_id;

...with an object-oriented syntax for relationships, built into the language...

SELECT post_title, author_id->fname AS author_name FROM posts;

...and that's SQL without the query complexity!

Learn more about the language and see just what's possible with the arrow syntax. (DOCS coming soon.)

Documentation

Objective SQL Documentions

Issues

To report bugs or request features, please submit an issue to this repository.

License

MIT.