Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Add support for var-arg db functions #439

Open
jczuchnowski opened this issue Apr 26, 2021 · 1 comment
Open

Add support for var-arg db functions #439

jczuchnowski opened this issue Apr 26, 2021 · 1 comment

Comments

@jczuchnowski
Copy link
Collaborator

Add support for var-arg db functions like format or concat.

@jgoday
Copy link
Contributor

jgoday commented May 4, 2021

@jczuchnowski can this implementation be a valid solution? (https://github.com/jgoday/zio-sql/tree/feature_variadic_args)

It would allow to call custom procedure/function with N different typed args.

val customFn = variadicFunc[String]("concat_ws")
val query    = select(customFn(", ", fName, lName)) from customers

A pending improvement could be to allow define variadicFunc with argument type parameters

val customFn = variadicFunc[String, Int, String]("custom_function")
val query    = select(customFn(name, id)) from table

but I can only imagine implementing this with macros ...

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

No branches or pull requests

2 participants