typelevel / typelevel/skunk

Support for noop commands

Open
#735 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.7k
Forks
175
Avg merge
5d 14h
Merged PRs (30d)
9

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the doList example and the proposed Command[Void] no-op behavior, then read Skunk's distinction between commands and queries and how PostgreSQL handles empty command input. There are no files or tests named in the issue; done would require an agreed API and behavior for empty lists, plus coverage demonstrating the resulting command handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, scala
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.