All Projects → sqorn → Sqorn

sqorn / Sqorn

Licence: mit
A Javascript library for building SQL queries

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Sqorn

Querybuilder
SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
Stars: ✭ 2,111 (+12.83%)
Mutual labels:  sql, query-builder, postgresql, sql-query-builder
Sqliterally
Lightweight SQL query builder
Stars: ✭ 231 (-87.65%)
Mutual labels:  sql, query-builder, postgresql, postgres
Squid
🦑 Provides SQL tagged template strings and schema definition functions.
Stars: ✭ 57 (-96.95%)
Mutual labels:  sql, query-builder, postgresql, postgres
Loukoum
A simple SQL Query Builder
Stars: ✭ 305 (-83.7%)
Mutual labels:  sql, query-builder, postgresql, postgres
Goqu
SQL builder and query library for golang
Stars: ✭ 984 (-47.41%)
Mutual labels:  sql, postgresql, postgres
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (-55.21%)
Mutual labels:  sql, postgresql, postgres
Scala Db Codegen
Scala code/boilerplate generator from a db schema
Stars: ✭ 49 (-97.38%)
Mutual labels:  sql, postgresql, postgres
Evolutility Server Node
Model-driven REST or GraphQL backend for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
Stars: ✭ 84 (-95.51%)
Mutual labels:  sql, query-builder, postgres
Jooq
jOOQ is the best way to write SQL in Java
Stars: ✭ 4,695 (+150.94%)
Mutual labels:  sql, postgresql, sql-query-builder
Rpg Boilerplate
Relay (React), Postgres, and Graphile (GraphQL): A Modern Frontend and API Boilerplate
Stars: ✭ 62 (-96.69%)
Mutual labels:  sql, postgresql, postgres
Electrocrud
Database CRUD Application Built on Electron | MySQL, Postgres, SQLite
Stars: ✭ 1,267 (-32.28%)
Mutual labels:  sql, postgresql, postgres
Efcore.pg
Entity Framework Core provider for PostgreSQL
Stars: ✭ 838 (-55.21%)
Mutual labels:  sql, postgresql, postgres
Vscode Sqltools
Database management for VSCode
Stars: ✭ 741 (-60.4%)
Mutual labels:  sql, postgresql, postgres
Citus
Distributed PostgreSQL as an extension
Stars: ✭ 5,580 (+198.24%)
Mutual labels:  sql, postgresql, postgres
Postgres Checkup
Postgres Health Check and SQL Performance Analysis. 👉 THIS IS A MIRROR OF https://gitlab.com/postgres-ai/postgres-checkup
Stars: ✭ 110 (-94.12%)
Mutual labels:  sql, postgresql, postgres
Sql
MySQL & PostgreSQL pipe
Stars: ✭ 81 (-95.67%)
Mutual labels:  sql, postgresql, postgres
Postguard
🐛 Statically validate Postgres SQL queries in JS / TS code and derive schemas.
Stars: ✭ 104 (-94.44%)
Mutual labels:  sql, query-builder, postgresql
Ship Hold
data access framework for Postgresql on nodejs
Stars: ✭ 110 (-94.12%)
Mutual labels:  query-builder, postgresql, postgres
Sqlx
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.
Stars: ✭ 5,039 (+169.32%)
Mutual labels:  sql, postgresql, postgres
Beam
A type-safe, non-TH Haskell SQL library and ORM
Stars: ✭ 454 (-75.73%)
Mutual labels:  sql, postgresql, postgres

Sqorn · License npm Supports Node 8+ npm Coverage Status

Sqorn is a Javascript library for building SQL queries.

Composable: Build complex queries from simple parts. Chain, extend, and embed queries.

Intuitive: Sqorn's use of modern Javascript language features like tagged template literals and promises makes building and issuing SQL queries a breeze.

Concise: Sqorn provides concise syntax for common CRUD operations.

Fast: 10x faster than Knex.js and 200x faster than Squel

Secure: Sqorn generates parameterized queries safe from SQL injection. Sqorn has no external dependencies.

Install

Sqorn requires Node version 8 or above.

npm install --save @sqorn/pg # only Postgres is currently supported

Then read the tutorial and try the online demo.

Examples

CRUD Operations are dead simple.

const sq = require('@sqorn/pg')()

const Person = sq`person`, Book = sq`book`

// SELECT
const children = await Person`age < ${13}`
// "select * from person where age < 13"

// DELETE
const [deleted] = await Book.delete({ id: 7 })`title`
// "delete from book where id = 7 returning title"

// INSERT
await Person.insert({ firstName: 'Rob' })
// "insert into person (first_name) values ('Rob')"

// UPDATE
await Person({ id: 23 }).set({ name: 'Rob' })
// "update person set name = 'Rob' where id = 23"

Build complex queries from simple parts.

// CHAIN QUERIES
sq.from`book`
  .return`distinct author`
  .where({ genre: 'Fantasy' })
  .where({ language: 'French' })
// select distinct author from book
// where language = 'French' and genre = 'Fantasy'

// EXTEND QUERIES
sq.extend(
  sq.from`book`,
  sq.return`distinct author`,
  sq.where({ genre: 'Fantasy' }),
  sq.where({ language: 'French' })
)
// select distinct author from book
// where language = 'French' and genre = 'Fantasy'

// EMBED Queries
sq.return`now() today, (${sq.return`now() + '1 day'`}) tomorrow`
// select now() today, (select now() + '1 day') tomorrow

Learn more in the tutorial.

Contributing

Sqorn is a monorepo managed with Lerna.

Clone the repo then run the following commands to install all dependencies:

npm install
npm run bootstrap # installs dependencies in all packages

npm test runs all tests. npm run clean removes all dependencies.

License

MIT Licensed, Copyright (c) 2018 Sufyan Dawoodjee

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].