6 releases (3 breaking)
|0.3.0||Jun 26, 2020|
|0.2.0||Jun 7, 2020|
|0.1.2||May 31, 2020|
|0.0.0||May 18, 2020|
#1486 in Database interfaces
48 downloads per month
Used in forma
An opinionated SQL formatter.
The binary may be installed via
$ cargo install forma
Further the companion library
formation may be required as a dependency:
[dependencies] formation = "0.3.0"
formashould be considered alpha quality, with several known, and many more unknown deficiencies. Use at your own risk!
forma some SQL via a file path or stdin and you'll get back formatted
$ echo "SELECT * FROM users" | forma select * from users;
To format a SQL file, simply give
forma the file path.
$ forma path/to/some/sql/example.sql
And if you'd prefer to not actually format the SQL but know if formatting
would happen then use the
The binary is a thin wrapper around the
formation library, which can be used
in your own applications to format SQL.
use formation::format; let sql = "SELECT * FROM users;"; assert_eq!( format(sql, false, 100).unwrap(), vec!["select * from users;\n".to_owned()] );
Statementvariant support (currently only
- Support for comments (these will be eaten by the formatter!)
- Parameterized dialects