query-face

Secure SQL query building library to get rid of static endpoints. Works best with Node.js query-face-node package.

Usage no npm install needed!

<script type="module">
  import queryFace from 'https://cdn.skypack.dev/query-face';
</script>

README

query-face · Build Status npm GitHub

ORM-like query language to get rid of static endpoints.

import qf from 'query-face';

qf()
  .select('*')
  .from('posts')
  .where('user_id', 2)
  .run();

output query object which will be sent to server you desire:

[
  { "$op": "select", "$params": ["*"] },
  { "$op": "from", "$params": ["posts"] },
  { "$op": "where", "$params": ["user_id", "=", 2] }
]

Documentation

Contributing

Any contributions are welcome.

git clone git@github.com:enginustun/query-face.git
npm ci

Your development must include:

  • Requirement codes
  • Test codes

All tests must be passed.

npm run test

Finish your development and open a PR.

Roadmap

  • Query Generation Core
    chainable query structure is ready.
  • Queries
    • select
    • insert
    • update
    • delete
    • from

    • where / andWhere / orWhere
    • whereNot / andWhereNot / orWhereNot
    • whereIn / andWhereIn / orWhereIn
    • whereNotIn / andWhereNotIn / orWhereNotIn
    • whereNull / orWhereNull
    • whereNotNull / orWhereNotNull
    • whereExists / orWhereExists
    • whereNotExists / orWhereNotExists
    • whereBetween / orWhereBetween
    • whereNotBetween / orWhereNotBetween
    • whereRaw

    • innerJoin
    • leftJoin
    • leftOuterJoin
    • rightJoin
    • rightOuterJoin
    • fullOuterJoin
    • crossJoin

    • on
    • onIn / andOnIn / orOnIn
    • onNotIn / andOnNotIn / orOnNotIn
    • onNull / andOnNull / orOnNull
    • onNotNull / andOnNotNull / orOnNotNull
    • onExists / andOnExists / orOnExists
    • onNotExists / andOnNotExists / orOnNotExists
    • onBetween / andOnBetween / orOnBetween
    • onNotBetween / andOnNotBetween / orOnNotBetween

    • having
    • havingIn
    • havingNotIn
    • havingNull
    • havingNotNull
    • havingExists
    • havingNotExists
    • havingBetween
    • havingNotBetween

    • distinct
    • groupBy
    • orderBy
    • offset
    • limit
    • returning
    • count
    • min
    • max
    • sum
    • avg
    • truncate
    • pluck
    • first
    • columnInfo
    • union
    • unionAll
    • with
    • withRecursive
    • withSchema
  • run
    this is the function that sends query to server.