Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0 A pretty-format functionality #266

Closed
green-coder opened this issue Jul 4, 2020 · 1 comment
Closed

2.0 A pretty-format functionality #266

green-coder opened this issue Jul 4, 2020 · 1 comment
Assignees
Milestone

Comments

@green-coder
Copy link

While using HoneySQL, I found myself often having to insert new lines in the SQL statements generated by the format function in order to read them and see if the SQL is what I wanted to obtain.

It would be nice for the user to have a programmatic way to make the generated SQL string readable on multiple lines.

I imagine multiple approaches:

  1. Having the format function take a :pretty true option.
  2. Having a separate pretty-format function just for development purpose.
  3. Having a pretty-sql function that changes a string of SQL into a prettier string of SQL.

The option 2 avoids any performance impact on the format function.
The option 3 additionally avoids any coupling between SQL generation and "pretty formatting".

@seancorfield seancorfield added this to the 2.0.0 milestone Aug 7, 2020
@seancorfield seancorfield self-assigned this Sep 24, 2020
@seancorfield seancorfield changed the title A pretty-format functionality 2.0 A pretty-format functionality Sep 24, 2020
seancorfield added a commit that referenced this issue Sep 26, 2020
Adds newline before, after, and between each SQL clause.
@seancorfield
Copy link
Owner

In 2.0, format will accept a :pretty? true option that will add newlines into the generated SQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants