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

sqquery

v1.0.8

Published

this is use for make query easy by fronted team

Downloads

16

Readme

Introduction

Unleash the Power of Your Backend Data!

Sqquerry empowers you to simplify backend data(JSON data) manipulation with a **powerful** suite of filtering and sorting functions.

Say goodbye to cumbersome data processing!

Sqquerry provides an intuitive API for tasks like:

  • Data filtering: Narrow down your data based on specific criteria.
  • Sorting: Order data by any field, ascending or descending.
  • Name searching: Quickly locate entries based on field values.
  • Date range filtering: Focus on specific timeframes for analysis.

sqquerry's clean and concise API integrates smoothly into your existing projects.

Benefits:

  • Saves time: Spend less time writing complex filtering logic and more time on core application features.
  • Increases productivity: No need to search for the data you want with the traditional methods. Fetch your data using Squerry easily.
  • Query Optimization

Embrace Sqquerry, and transform your backend data manipulation!

Table of contents

Use Case

In every projects filtering, sorting, searching and server side pagination of the data are on some of the most common operations. But there are lots of options available for these operations. For example data can be filtered or sorted by name, salary, age etc. To allow this multiple options you have put conditions manually in your code. The sqqury gives you flexibility to play with all the possible options without adding corresponding conditions manually. The sqquery generate theses conditions dynamically based on the options passed from the front-end.

Filtering data & Pagination with sqquery

exports.getAllUsers = async (req, res, next) => {
  try {
    const users = await User.findAll(sqquery(req.query));

    res.status(200).send({
      status: 200,
      results: users.length,
      data: {
        users,
      },
    });
  } catch (error) {
    next(error);
  }
};

You can also set some fix conditions for filtering data with sqquery. If the same condition is passed from the frontend then it will be overwritten by the static condition that you have passed in the sqquery.

exports.getAllUsers = async (req, res, next) => {
  try {
    const users = await User.findAll(sqquery(req.query, {
        role: "Admin" // Fixed condition
    ));

    res.status(200).send({
      status: 200,
      results: users.length,
      data: {
        users,
      },
    });
  } catch (error) {
    next(error);
  }
};

How to pass options from front end:

**{{URL}}/admins/users/?page=5&limit=10&role=admin&city=Ahmedabad&age[gt]=18&age[lt]=50**

Here page (Page number) and limit(Number of data in one page) are for the pagination.

Sorting data with sqquery

exports.getAllUsers = async (req, res, next) => {
  try {
    const users = await User.findAll(sqquery(req.query));

    res.status(200).send({
      status: 200,
      results: users.length,
      data: {
        users,
      },
    });
  } catch (error) {
    next(error);
  }
};

How to pass options from front end:

{{URL}}/admins/users/?sortBy=age&sortOrder=ASC