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

Support for noop commands #735

Open
umazalakain opened this issue Nov 10, 2022 · 0 comments
Open

Support for noop commands #735

umazalakain opened this issue Nov 10, 2022 · 0 comments

Comments

@umazalakain
Copy link

umazalakain commented Nov 10, 2022

Let's say we have a command builder doList of type (xs: List[A]) => Command[xs.type] defined as an sql"INSERT INTO [...] VALUES ${enc.values.list(xs)}" where enc is of type Encoder[A]. This command will succeed so long the input list is non-empty. If it's empty it will fail with a syntax error on the empty list of tuples().

I am trying to handle the empty case within the definition of doList, so that we don't have to bother to check for it on the caller's side. As far as I am aware, there seems to be no no-op command in postgresql. Using dummy selector commands like SELECT NULL doesn't work with Skunk since these return results and are therefore understood as queries.

Would it be advisable to add some sort of singleton type no-op command of type Command[Void] to Skunk and interpret it as sending nothing down the wire to postgresql?

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

1 participant