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

Make built-in SQL functions and operators available in @funsql macro #53

Open
xitology opened this issue Feb 15, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@xitology
Copy link
Member

For use with @funsql macro, FunSQL currently exports a small number of common SQL functions and operators:

Any SQL function not in these lists has to be declared like this:

const var"funsql_%" = FunSQL.Fun."%"
const funsql_array_get = FunSQL.Fun."?[?]"
const funsql_as_integer = FunSQL.Fun."(?::integer)"
const funsql_bool_and = FunSQL.Agg.bool_and
const funsql_regexp_matches = FunSQL.Fun.regexp_matches
const funsql_string_agg = FunSQL.Agg."string_agg(?, NULL ORDER BY ?)"

Ideally, FunSQL should provide all built-in functions and operators, for every supported database engine. Since every engine has its own list of supported functions, these declarations could be added to engine-specific modules:

using FunSQL, FunSQL.PostgreSQL
@funsql select(as_integer("0")) #-> SELECT ('0'::integer)
@clarkevans clarkevans added the enhancement New feature or request label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants