Skip to content

Conversation

@adam-fowler
Copy link
Collaborator

@adam-fowler adam-fowler commented Apr 16, 2025

This PR has a number of minor fixes to code generation plus has added the ability to setup our own custom return values for commands.

  • Commands with return values tagged as Set now return an RESPToken.Array instead of a RESPToken.
  • Arrays are returned as RESPToken.Array. If you want an Array you can use the converting(to:) function.
  • Dictionaries are returned as RESPToken.Map. If you want a Dictionary you can use the converting(to:) function.
  • The functions for Commands that only return simple string OK return Void.
  • Commands where code generation cannot ascertain the return value, don't explicitly set the Response and use the default value of RESPToken. This allows us to override these in code.
  • Added Response overrides for the string and list commands LCS, LPOP, LPOS, RPOP.

- Commands that only return simple OK return Void
- Commands that return a Set, return an [RESPToken]
- Remove Response typealias when it is RESPToken so it can be overridden
@adam-fowler adam-fowler requested a review from fabianfett April 16, 2025 11:29
@github-actions
Copy link

github-actions bot commented Apr 16, 2025

Pull request benchmark comparison [ubuntu-latest] with 'main' run at 2025-04-18T10:54:50+00:00
Pull request no significant performance differences ✅

Copy link
Collaborator

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix description though.

@adam-fowler adam-fowler merged commit e9d9d97 into main Apr 24, 2025
@adam-fowler adam-fowler deleted the code-generation-custom-return-values branch April 24, 2025 09:29
adam-fowler added a commit that referenced this pull request Jul 11, 2025
* Code generation cleanup  and fixes

- Commands that only return simple OK return Void
- Commands that return a Set, return an [RESPToken]
- Remove Response typealias when it is RESPToken so it can be overridden

* Add custom return values for string and list commands

* Return RESPToken.Array, RESPToken.Map
adam-fowler added a commit that referenced this pull request Jul 14, 2025
* Code generation cleanup  and fixes

- Commands that only return simple OK return Void
- Commands that return a Set, return an [RESPToken]
- Remove Response typealias when it is RESPToken so it can be overridden

* Add custom return values for string and list commands

* Return RESPToken.Array, RESPToken.Map
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

Successfully merging this pull request may close these issues.

3 participants