New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@umatch/query

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@umatch/query

Simple query builder for PostgreSQL. Inspired by knex.

latest
Source
npmnpm
Version
6.0.1
Version published
Maintainers
0
Created
Source

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
  • TODO
  • FAQ

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.

Keywords

query builder

FAQs

Package last updated on 08 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts