A fast, synchronized and dynamic query builder package.

Overview


@ssibrahimbas/query

A fast, synchronized and dynamic query builder package.

What is?

In short, the query builder. You can write complex and parameterized queries fast, plain and dynamically using the Query class, which uses the chain of responsibility pattern!

Motivation

Generally, adding parameters to queries and parsing objects increases the distance of us as software developers to sql. This package was influenced by mongoose's Query class, aiming to make it usable in SQL databases, and that's what it ultimately does.

Run it on the drive you want! Sequelize can work with postgresql or any driver. All it needs is a driver that accepts sql code!

Looking forward to your pull requests and issues to make this package better.

Finally, all functions are gesture tested.

Installation

To include this package in your project, run the following command:

npm install @ssibrahimbas/query

or with yarn

yarn add @ssibrahimbas/query

And try this:

import { Query } from "@ssibrahimbas/query"

console.log(Query.table("users").getAll())

// SELECT * FROM users

Contributing

If you want to contribute to the project or play with the codes on your local machine, follow the steps below:

install dependencies:

npm install

or with yarn

yarn

run tests

npm run test

or with yarn

yarn test

Documentation

Interface
ISsiQuery
Functions
table(...)
select(...)
groupConcat(...)
least(...)
max(...)
min(...)
sum(...)
count(...)
avg(...)
innerJoin(...)
leftJoin(...)
rightJoin(...)
fullOuterJoin(...)
leftOuterJoin(...)
rightOuterJoin(...)
where(...)
orWhere(...)
notWhere(...)
orNotWhere(...)
whereNull(...)
whereNotNull(...)
grouped(...)
in(...)
notIn(...)
orIn(...)
orNotIn(...)
findInSet(...)
notFindInSet(...)
orFindInSet(...)
orNotFindInSet(...)
between(...)
notBetween(...)
orBetween(...)
orNotBetween(...)
like(...)
orLike(...)
notLike(...)
orNotLike(...)
limit(...)
pagination(...)
orderBy(...)
groupBy(...)
having(...)
query(...)
get()
getAll()
insert(...)
update(...)
delete()
analyze()
check()
checksum()
optimize()
repair()
reset()

ISsiQuery

Abstract of the Query class. If you wish, you can use as follows:

import { ISsiQueue, SsiQuery } from "@ssibrahimbas/query"

const Query : ISsiQuery = new SsiQuery();

Although this doable, it is memory redundant as the new key is constantly used. The Queue class has been developed to reset itself after each query. So you can use it with peace of mind as follows:

import { Query } from "@ssibrahimbas/query"

Functions


table

It is used to declare a table in SQL.

Abstract:

table(table: string | Array<string>) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").getAll();

// SELECT * FROM users

Using arrays:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table(["users", "products"]).analyze();

// ANALYZE TABLE users, products

select

Select the fields to use for the query

Abstract:

select(fields: Record<string,string> | Array<Record<string, string>> | string | Array<string>) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").select("id").getAll();

// SELECT id FROM users

Using arrays:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").select(["id As userId", "name As userName"]).analyze();

// SELECT id As userId, name As userName FROM users

Using Records:

import { Query } from "@ssibrahimbas/query"

const data = { Id: "userId", FirstName: "firstName" };
const query : string = Query.table("users").select(data).getAll();

// SELECT Id AS userId, FirstName AS firstName FROM users

Using Records With Arrays:

import { Query } from "@ssibrahimbas/query"

const data: Array<Record<string, string>> = [
  { Id: "userId" },
  { FirstName: "firstName" },
];
const query : string = Query.table("users").select(data).getAll();

// SELECT Id AS userId, FirstName AS firstName FROM users

least

Abstract:

least(fields: Array<string>, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").least(["point1", "point2", "point3"], "minPoint").getAll();

// "SELECT LEAST(point1, point2, point3) AS minPoint FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").least(["point1", "point2", "point3"]).getAll();

// "SELECT LEAST(point1, point2, point3) FROM users"

groupConcat

Abstract:

groupConcat(fields: string, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").groupConcat("UserId", "users").getAll();

// "SELECT GROUP_CONCAT(UserId) AS users FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").groupConcat("UserId").getAll();

// "SELECT GROUP_CONCAT(UserId) FROM users"

max

Abstract:

max(fields: string, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").max("id", "count").getAll();

// "SELECT MAX(id) AS count FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").max("id").getAll();

// "SELECT MAX(id) FROM users"

min

Abstract:

min(fields: string, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").min("id", "count").getAll();

// "SELECT MIN(id) AS count FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").min("id").getAll();

// "SELECT MIN(id) FROM users"

sum

Abstract:

sum(fields: string, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").sum("id", "count").getAll();

// "SELECT SUM(id) AS count FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").sum("id").getAll();

// "SELECT SUM(id) FROM users"

count

Abstract:

count(fields: string, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").count("id", "count").getAll();

// "SELECT COUNT(id) AS count FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").count("id").getAll();

// "SELECT COUNT(id) FROM users"

avg

Abstract:

avg(fields: string, name?: string | null) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").avg("id", "avg").getAll();

// "SELECT AVG(id) AS avg FROM users"

Single Parameter:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").avg("id").getAll();

// "SELECT AVG(id) FROM users"

innerJoin

Abstract:

innerJoin(table: string, field1: string, operator?: string, field2?: string) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("user_posts")
    .select([
      "user_posts.id as postId",
      "user_posts.title as postTitle",
      "users_username as username",
    ])
    .innerJoin("users", "user_posts.userId", "users.id")
    .getAll();

// "SELECT user_posts.id as postId, user_posts.title as postTitle, users_username as username FROM user_posts INNER JOIN users ON user_posts.userId = users.id"

leftJoin

Abstract:

leftJoin(table: string, field1: string, operator?: string, field2?: string) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .select(["users.id As userId", "user_posts.title As postTitle"])
    .leftJoin("user_posts", "users.id", "user_posts.userId")
    .getAll();

// "SELECT users.id As userId, user_posts.title As postTitle FROM users LEFT JOIN user_posts ON users.id = user_posts.userId"

rightJoin

Abstract:

rightJoin(table: string, field1: string, operator?: string, field2?: string) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("user_posts")
    .select(["users.id As userId", "user_posts.title As postTitle"])
    .rightJoin("users", "user_posts.userId", "users.id")
    .getAll();

// "SELECT users.id As userId, user_posts.title As postTitle FROM user_posts RIGHT JOIN users ON user_posts.userId = users.id"

fullOuterJoin

Abstract:

fullOuterJoin(table: string, field1: string, operator?: string, field2?: string) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .select(["users.id As userId", "user_posts.title As postTitle"])
    .fullOuterJoin("user_posts", "users.id", "user_posts.userId")
    .getAll();

// "SELECT users.id As userId, user_posts.title As postTitle FROM users FULL OUTER JOIN user_posts ON users.id = user_posts.userId"

leftOuterJoin

Abstract:

leftOuterJoin(table: string, field1: string, operator?: string, field2?: string) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .select(["users.id As userId", "user_posts.title As postTitle"])
    .leftOuterJoin("user_posts", "users.id", "user_posts.userId")
    .getAll();

// "SELECT users.id As userId, user_posts.title As postTitle FROM users LEFT OUTER JOIN user_posts ON users.id = user_posts.userId"

rightOuterJoin

Abstract:

rightOuterJoin(table: string, field1: string, operator?: string, field2?: string) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("user_posts")
    .select(["users.id As userId", "user_posts.title As postTitle"])
    .rightOuterJoin("users", "user_posts.userId", "users.id")
    .getAll();

// "SELECT users.id As userId, user_posts.title As postTitle FROM user_posts RIGHT OUTER JOIN users ON user_posts.userId = users.id"

where

Abstract:

where(
    where: string | Array<string>,
    operator?: string | Array<string> | boolean | null,
    val?: string | null | number,
    type?: string,
    andOr?: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .where("id", "=", "1")
    .getAll();

// "SELECT * FROM users WHERE id = '1'"

orWhere

Abstract:

orWhere(
    where: string | Array<string>,
    operator?: string | Array<string> | boolean | null,
    val?: string | null | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .where("age", "20")
    .orWhere("age", ">", "25")
    .getAll();

// "SELECT * FROM users WHERE age = '20' OR age > '25'"

notWhere

Abstract:

notWhere(
    where: string | Array<string>,
    operator?: string | Array<string> | boolean | null,
    val?: string | null | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .where("age", "20")
    .notWhere("age", ">", "25")
    .getAll();

// "SELECT * FROM users WHERE age = '20' AND NOT age > '25'"

orNotWhere

Abstract:

orNotWhere(
    where: string | Array<string>,
    operator?: string | Array<string> | boolean | null,
    val?: string | null | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .where("age", "20")
    .orNotWhere("age", ">", "25")
    .getAll();

// "SELECT * FROM users WHERE age = '20' OR NOT age > '25'"

whereNull

Abstract:

whereNull(
    where: string,
    not?: boolean
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").whereNull("email").getAll();

// "SELECT * FROM users WHERE email IS NULL"

whereNotNull

Abstract:

whereNotNull(
    where: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users").whereNotNull("email").getAll();

// "SELECT * FROM users WHERE email IS NOT NULL"

grouped

Abstract:

grouped(
    callback: (q: ISsiQuery) => any
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .grouped((q) => {
      q.where("country", "TURKEY").orWhere("country", "ENGLAND");
    })
    .getAll();

// "SELECT * FROM users WHERE (country = 'TURKEY' OR country = 'ENGLAND')"

in

Abstract:

in(
    field: string,
    keys: Array<string | number>,
    type?: string,
    andOr?: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("users")
    .in("state", [1, 2, 3, 4])
    .getAll();

// "SELECT * FROM users WHERE state IN ('1', '2', '3', '4')"

notIn

Abstract:

notIn(
    field: string,
    keys: Array<string | number>
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .notIn("id", [1, 2, 3])
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND id NOT IN ('1', '2', '3')"

orIn

Abstract:

orIn(
    field: string,
    keys: Array<string | number>
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orIn("id", [1, 2, 3])
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR id IN ('1', '2', '3')"

orNotIn

Abstract:

orNotIn(
    field: string,
    keys: Array<string | number>
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orNotIn("id", [1, 2, 3])
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR id NOT IN ('1', '2', '3')"

findInSet

Abstract:

findInSet(
    field: string,
    key: string | number,
    type?: string,
    andOr?: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .findInSet("selected_tests", 1)
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND FIND_IN_SET (1, selected_tests)"

notFindInSet

Abstract:

notFindInSet(
    field: string,
    key: string | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .notFindInSet("selected_tests", 1)
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND NOT FIND_IN_SET (1, selected_tests)"

orFindInSet

Abstract:

orFindInSet(
    field: string,
    key: string | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orFindInSet("selected_tests", 1)
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR FIND_IN_SET (1, selected_tests)"

orNotFindInSet

Abstract:

orNotFindInSet(
    field: string,
    key: string | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string =  Query.table("test")
    .where("active", "1")
    .orNotFindInSet("selected_tests", 1)
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR NOT FIND_IN_SET (1, selected_tests)"

between

Abstract:

between(
    field: string,
    value1: string | number,
    value2: string | number,
    type?: string,
    andOr?: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .between("age", 12, 35)
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND (age BETWEEN '12' AND '35')"

notBetween

Abstract:

notBetween(
    field: string,
    value1: string | number,
    value2: string | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .notBetween("age", 12, 35)
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND (age NOT BETWEEN '12' AND '35')"

orBetween

Abstract:

orBetween(
    field: string,
    value1: string | number,
    value2: string | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orBetween("age", 12, 35)
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR (age BETWEEN '12' AND '35')"

orNotBetween

Abstract:

orNotBetween(
    field: string,
    value1: string | number,
    value2: string | number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orNotBetween("age", 12, 35)
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR (age NOT BETWEEN '12' AND '35')"

like

Abstract:

like(
    field: string,
    data: string,
    type?: string,
    andOr?: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .like("title", "%nodeJS%")
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND title LIKE '%nodeJS%'"

orLike

Abstract:

orLike(
    field: string,
    data: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orLike("title", "%nodeJS%")
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR title LIKE '%nodeJS%'"

notLike

Abstract:

notLike(
    field: string,
    data: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .notLike("title", "%nodeJS%")
    .getAll();

// "SELECT * FROM test WHERE active = '1' AND title NOT LIKE '%nodeJS%'"

orNotLike

Abstract:

orNotLike(
    field: string,
    data: string
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orNotLike("title", "%nodeJS%")
    .getAll();

// "SELECT * FROM test WHERE active = '1' OR title NOT LIKE '%nodeJS%'"

limit

Abstract:

limit(
    limit: number,
    limitEnd?: number | null
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test").where("active", "1").limit(20).getAll();

// "SELECT * FROM test WHERE active = '1' LIMIT 20"

offset

Abstract:

offset(
    offset: number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .limit(20)
    .offset(200)
    .getAll();

// "SELECT * FROM test WHERE active = '1' LIMIT 20 OFFSET 200"

pagination

Abstract:

pagination(
    perPage: number,
    page: number
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .pagination(20, 1)
    .getAll();

// "SELECT * FROM test WHERE active = '1' LIMIT 20 OFFSET 20"

orderBy

Abstract:

orderBy(
    orderBy: string,
    orderDir?: string | null
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .orderBy("date", "desc")
    .getAll();

// "SELECT * FROM test WHERE active = '1' ORDER BY date DESC"

groupBy

Abstract:

groupBy(
    groupBy: string | Array<string>
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test").where("active", "1").groupBy("id").getAll();

// "SELECT * FROM test WHERE active = '1' GROUP BY id"

having

Abstract:

having(
    field: string,
    operator?: string | Array<string> | null,
    val?: string | null
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const query : string = Query.table("test")
    .where("active", "1")
    .groupBy("place")
    .having("AVG(salary)", ">=", "3000")
    .getAll();

// "SELECT * FROM test WHERE active = '1' GROUP BY place HAVING AVG(salary) >= '3000'"

query

Abstract:

query(
    query: string,
    values?: Array<string | number> | null
) : ISsiQuery;

Example:

import { Query } from "@ssibrahimbas/query"

const _query = "SELECT * FROM users WHERE userId = ?";
const query = Query.query(_query, ["1"]).getQuery();

// "SELECT * FROM users WHERE userId = '1'"

get

Builds the select query with a limit of 1

Abstract:

get() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("users").select("id, firstName").get();

// "SELECT id, firstName FROM users LIMIT 1"

getAll

Builds the select query

Abstract:

getAll() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("users").select("id, firstName").getAll();

// "SELECT id, firstName FROM users"

insert

Builds the insert query

Abstract:

insert(data: object) : string;

Example:

import { Query } from "@ssibrahimbas/query"

const data = {
    id: "3",
    firstName: "John",
  };
const query = Query.table("test").insert(data);

// "INSERT INTO test (id, firstName) VALUES ('3', 'John')"

update

Builds the update query

Abstract:

update(data: object) : string;

Example:

import { Query } from "@ssibrahimbas/query"

const data = {
    firstName: "John",
    age: 22,
  };
const query = Query.table("test").where("id", "3").update(data);

// "UPDATE test SET firstName='John', age='22' WHERE id = '3'"

delete

Builds the delete query

Abstract:

delete() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("test").where("id", "54").delete();

// "DELETE FROM test WHERE id = '54'"

analyze

Builds the analyze query

Abstract:

analyze() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("test").analyze();

// "ANALYZE TABLE test"

check

Builds the check query

Abstract:

check() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("test").check();

// "CHECK TABLE test"

checksum

Builds the checksum query

Abstract:

checksum() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("test").checksum();

// "CHECKSUM TABLE test"

optimize

Builds the optimize query

Abstract:

optimize() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table("test").optimize();

// "OPTIMIZE TABLE test"

repair

Builds the repair query

Abstract:

repair() : string;

Example:

import { Query } from "@ssibrahimbas/query"

const query = Query.table(["test", "test_2"]).repair();

// "REPAIR TABLE test, test_2"

reset

It clears all the values of the query in the class, it is not recommended to use it externally.

Abstract:

reset() : void;

Example:

import { Query } from "@ssibrahimbas/query"

Query.reset();
You might also like...

StashQL is a light-weight, open-source npm package that improves the speed of your GraphQL queries in your application.

StashQL is a light-weight, open-source npm package that improves the speed of your GraphQL queries in your application.

Table of Contents What is StashQL? Install Getting Started Queries Mutations refillCache clearRelatedFields Logging The Team What is StashQL? StashQL

Sep 30, 2022

Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed.

Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed.

About Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed. Features NoSQL database Can be run as

Dec 7, 2022

Fast and advanced, document-based and key-value-based NoSQL database.

Fast and advanced, document-based and key-value-based NoSQL database.

Contents About Features Installation Links About Fast and advanced, document-based and key-value-based NoSQL database. Features NoSQL database Can be

Dec 7, 2022

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.

Lovefield Lovefield is a relational database written in pure JavaScript. It provides SQL-like syntax and works cross-browser (currently supporting Chr

Jan 3, 2023

Database in JSON, fast and optimize

📍 Database-Dev 🔧 DevNetwork#2103 🔖 V 1.0.0 📚 Dependence Libs use 💎 NodeJs V 16.14.2 (NodeJs) 💎 fs (nodeFS) 💻 Use libs import the file in your p

Apr 21, 2022

Fast File is a quick and easy-to-use library to convert data sources to a variety of options.

Fast File is a quick and easy-to-use library to convert data sources to a variety of options.

Fast File Converter The Express.js's Fast File Converter Library Fast File Converter Library is a quick and easy-to-use library to convert data source

Nov 16, 2022

Thin Backend is a Blazing Fast, Universal Web App Backend for Making Realtime Single Page Apps

Thin Backend is a Blazing Fast, Universal Web App Backend for Making Realtime Single Page Apps

Website | Documentation About Thin Thin Backend is a blazing fast, universal web app backend for making realtime single page apps. Instead of manually

Dec 25, 2022

A simple, fast, reliable Object Relationship Manager for Bun.

Burm is an object relational manager for Bun, the fastest Javascript Engine. The name is a merge of "Bun" and "ORM", forming "Burm". Pronounce it howe

Dec 28, 2022

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a

Jan 9, 2023
Releases(Latest)
  • Latest(Jun 5, 2022)

    Added support for Record<string, string> and Array<Record<string, string>> for select function. Now you can give only one object to the select function. The key and value fields of the object are combined with the AS keyword.

    You may be using the LEAST function to calculate the smallest value of certain columns in SQL, we now have support for the least function!

    You may be using the GROUP_CONCAT function in SQL often, we now have support for the groupConcat function!

    Here are the additions to the documentation:

    select

    Select the fields to use for the query

    Abstract:

    select(fields: Record<string,string> | Array<Record<string, string>> | string | Array<string>) : ISsiQuery;
    

    Using Records:

    import { Query } from "@ssibrahimbas/query"
    
    const data = { Id: "userId", FirstName: "firstName" };
    const query : string = Query.table("users").select(data).getAll();
    
    // SELECT Id AS userId, FirstName AS firstName FROM users
    

    Using Records With Arrays:

    import { Query } from "@ssibrahimbas/query"
    
    const data: Array<Record<string, string>> = [
      { Id: "userId" },
      { FirstName: "firstName" },
    ];
    const query : string = Query.table("users").select(data).getAll();
    
    // SELECT Id AS userId, FirstName AS firstName FROM users
    

    least

    Abstract:

    least(fields: Array<string>, name?: string | null) : ISsiQuery;
    

    Example:

    import { Query } from "@ssibrahimbas/query"
    
    const query : string = Query.table("users").least(["point1", "point2", "point3"], "minPoint").getAll();
    
    // "SELECT LEAST(point1, point2, point3) AS minPoint FROM users"
    

    Single Parameter:

    import { Query } from "@ssibrahimbas/query"
    
    const query : string = Query.table("users").least(["point1", "point2", "point3"]).getAll();
    
    // "SELECT LEAST(point1, point2, point3) FROM users"
    

    groupConcat

    Abstract:

    groupConcat(fields: string, name?: string | null) : ISsiQuery;
    

    Example:

    import { Query } from "@ssibrahimbas/query"
    
    const query : string = Query.table("users").groupConcat("UserId", "users").getAll();
    
    // "SELECT GROUP_CONCAT(UserId) AS users FROM users"
    

    Single Parameter:

    import { Query } from "@ssibrahimbas/query"
    
    const query : string = Query.table("users").groupConcat("UserId").getAll();
    
    // "SELECT GROUP_CONCAT(UserId) FROM users"
    

    Source code(tar.gz)
    Source code(zip)
Owner
Sami Salih İbrahimbaş
Full Stack Developer
Sami Salih İbrahimbaş
Burger builder project using React, Hooks and Context API.

Burger Builder In this project, I made a context-api project by creating hamburgers with 3 different materials. Project setup npm install Project star

Efecan Pınar 4 Jun 17, 2021
~900 byte minified CSV parser and builder. Smaller when compressed. Built in ESM only.

but-csv ~900 byte minified CSV parser and builder. Smaller when compressed. Built in ESM only. Doesn't care about headers, keyed rows, anything but st

Sam Thorogood 16 Nov 13, 2022
Dead Simple Postgres Data Viewer and Query Runner

Dead Simple Postgres Data Viewer and Query Runner Environment Variables GITHUB_CLIENT_ID Github Client ID of the Oauth Application for protecting your

Mahesh C. Regmi 7 Aug 22, 2022
Modern Query - jQuery like syntax the ES6 way

mQuery Inspired by jQuery, I want to create a small library that resembels the simplicity and ease of use of jQuery, but uses modern API of ever-green

Vitali Malinouski 16 Dec 13, 2022
A Node.js library for retrieving data from a PostgreSQL database with an interesting query language included.

RefQL A Node.js library for retrieving data from a PostgreSQL database with an interesting query language included. Introduction RefQL is about retrie

Rafael Tureluren 7 Nov 2, 2022
Database driven code generation for ts-sql-query

ts-sql-codegen This utility generates table mapper classes for ts-sql-query by inspecting a database through tbls. While it is possible to use ts-sql-

Lorefnon 12 Dec 12, 2022
One-stop TLS traffic inspection and manipulation using dynamic instrumentation

hallucinate Author: Moritz Bechler [email protected] Project Repository: https://github.com/SySS-Research/hallucinate License: MIT Originally ins

SySS Research 215 Dec 16, 2022
⛰ "core" is the core component package of vodyani, providing easy-to-use methods and AOP implementations.

Vodyani core ⛰ "core" is the core component package of vodyani, providing easy-to-use methods and AOP implementations. Installation npm install @vodya

Vodyani 25 Oct 18, 2022
Microsoft-store - Microsoft Store package for LTSC.

Microsoft Store Microsoft Store package for Windows LTSC. Usage Just download the release and double click the exe file. Can be used in Windows LTSC 2

fernvenue 7 Jan 2, 2023
A simple yet powerful discord.js embed pagination package.

Pagination.djs A discord.js compatible pagination module. It's a simple and lightweight module to paginate discord embeds. Read docs here: pagination.

Parbez 12 Nov 9, 2022