6.0.1 • Published 11 months ago

@umatch/query v6.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Uquery

Simple query builder for PostgreSQL. Inspired by knex.

Warning: security against injections or attacks of any kind is at an early stage of development. Use at your own risk, and parse user input beforehand.

Table of contents

Features

  • Full TypeScript support
  • Object syntax
    • where({ name: 'Bob' }) -> WHERE name = 'Bob'
    • where({ content: null }) -> WHERE content IS NULL
    • where({ created_at: new Date() }) -> WHERE created_at = '2023-01-01T00:00:00.000Z'
    • where({ created_at: '> NOW()' }) -> WHERE created_at > NOW()
  • Automatic aliasing of joined tables
    • leftJoin('users', { id: 'posts.user.id' }) -> LEFT JOIN users AS u ON u.id = posts.user_id
  • Extra methods
    • excludeJoin: exclude rows that join on the conditions - excludeJoin("posts", { user_id: "users.id" }) -> LEFT JOIN posts AS exclude_posts ON exclude_posts.user_id = users.id WHERE exclude_posts.user_id IS NULL

TODO

  • Test SQL injection countermeasures
  • Add more SQL injection countermeasures
  • Add date methods (whereAfter, whereBefore, etc.)
  • Create and keep track of aliases for tables automatically

FAQ

Why?

I wanted something simple, yet intuitive, and with a better developer experience than knex. Some shortcomings I wanted to address were:

  • comparing dates in object syntax
  • joining other queries
  • excluding rows intuitively (excludeJoin)

You could've done it in XYZ way.

I probably didn't know. This is a learning experience for me and a work in progress, constantly evolving.

Tell me either way, I want to learn and improve! Feel free to open an issue or PR.

Who asked these questions?

I actually made them up. I'm just trying to make this readme look more interesting. But I do hope they will be asked one day.

6.0.1

11 months ago

6.0.0

11 months ago

5.1.0

12 months ago

5.2.0

12 months ago

5.0.0

12 months ago

4.2.0

1 year ago

4.1.0

1 year ago

4.0.1

1 year ago

3.14.4

2 years ago

4.0.0

2 years ago

3.14.1

2 years ago

3.14.0

2 years ago

3.9.2

2 years ago

3.14.3

2 years ago

3.9.1

2 years ago

3.14.2

2 years ago

3.9.0

2 years ago

3.11.0

2 years ago

3.10.0

2 years ago

3.13.0

2 years ago

3.12.0

2 years ago

3.11.1

2 years ago

3.8.0

2 years ago

3.7.0

2 years ago

3.6.1

2 years ago

3.6.0

2 years ago

3.5.1

2 years ago

3.5.0

2 years ago

3.4.4

2 years ago

3.4.3

2 years ago

3.4.0

2 years ago

3.3.0

2 years ago

3.2.1

2 years ago

3.2.0

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.4.2

2 years ago

3.4.1

2 years ago

3.0.0

2 years ago

2.2.1

2 years ago

2.2.0

2 years ago

2.1.1

2 years ago

2.2.2

2 years ago

2.1.0

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

1.0.0

2 years ago