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

Create interceptor for processing custom tagged template value expressions #21

Closed
gajus opened this issue Feb 11, 2019 · 2 comments
Closed

Comments

@gajus
Copy link
Owner

gajus commented Feb 11, 2019

The way that Slonik is using tagged template literals to generate code fragments and safely bind parameter values is particularly exciting. Therefore, I am exploring feasibility of allowing community to bring their own code-generating extensions that integrate into Slonik template language. These extensions will allow to abstract business-specific fragments of code (e.g. dynamic WHERE conditions for a particular business requirement); big development teams can use this pattern to restrict any use of raw.sql in the main codebase. This enables separating integration and code generation tests.

The primary considerations:

  • Design of value expression that does not compromise the strict type nature of the current tags.
  • Client configuration that restricts use of sql.raw tokens, but allows custom extensions.
@gajus
Copy link
Owner Author

gajus commented Feb 15, 2019

This should also provide features equivalent to https://github.com/vitaly-t/pg-promise#custom-type-formatting.

@gajus
Copy link
Owner Author

gajus commented Oct 23, 2019

Users can already create custom tags simply by using the already available query building utilities.

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

No branches or pull requests

1 participant