calustra-query

0.3.0 • Public • Published

Calustra logo

NPM Version NPM Downloads

Intro

calustra-query is a small -yet powerful- set of utils over SQL queries.

Install

npm install calustra-query [--save-dev]

API

getTableNamesFromQuery (query)

Returns an array of the table names involved in query.

removeComments (query)

Cleans comments from query.

cleanAndInline (query)

Cleans comments from query, also compacting it in a single line if multiline.

queryMainAction (query)

Checks what the main action of the query is, even for the hard ones. Possible return values are: create, alter, drop, insert, update, delete, select.

queryDescription (query, rows, time)

Returns a human readable description of the query.

Examples:

  • Created table cars (time: <time>)
  • Inserted <rows> rows into cars (time: <time>)

formatQuery (qry, params)

Clean and colorize a query with logging in mind.

Readme

Keywords

Package Sidebar

Install

npm i calustra-query

Weekly Downloads

1

Version

0.3.0

License

MIT

Unpacked Size

50.6 kB

Total Files

16

Last publish

Collaborators

  • afialapis