sqlformat-rs
sqlformat-rs copied to clipboard
SQL Formatter written in Rust
When formatting the postgres query: ```sql INSERT INTO "public"."users"("name") VALUES (E'alice'); ``` It turns into: ```sql INSERT INTO "public"."users"("name") VALUES (E 'alice'); ``` The space between the `E` and the...
Some examples I've encountered: | Before | After | | ------- | ----- | | `` | `< ->` | | `` | `` | | `&&` | `& &`...
From the tests ``` rust " INSERT INTO some_table (id_product, id_shop, id_currency, id_country, id_registration) ( SELECT IF(dq.id_discounter_shopping = 2, dq.value, dq.value / 100), IF (dq.id_discounter_shopping = 2, 'amount', 'percentage') FROM...
A query like this: ```sql SELECT * FROM users WHERE id = 1; ``` gets formatted as: ```sql SELECT * FROM users WHERE id = 1; ``` Would it be...
The following SQL statements are fed to the formatter: ```sql SELECT trackid, name FROM tracks WHERE name GLOB 'Man*'; SELECT trackid, name FROM tracks WHERE name GLOB '*Man'; SELECT trackid,...
For the following input: ```sql CREATE OR REPLACE FUNCTION foo() RETURNS TEXT ``` the following formatted query is returned: ```sql CREATE OR REPLACE FUNCTION foo() RETURNS TEXT ``` The same...
This is not in sql standard but some libraries are using `{{ abc }}` for interpolation currently this works like this: ``` SELECT {{abc}}, FROM table_name ``` becomes: ``` SELECT...
Like the titles says, would it be beneficial to this formatter to control the number of new lines at the end of input? Currently working on integrating this into deno...
It is common in editors to highlight a specific line or region of code, pass it through a formatter, and replace the highlighted region with the output of the formatter....