-
Notifications
You must be signed in to change notification settings - Fork 13
Add response types for KEYS and SCAN commands #244
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Natan Rolnik <[email protected]>
aafc50e
to
785b46d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #244 +/- ##
=======================================
Coverage ? 39.51%
=======================================
Files ? 93
Lines ? 15721
Branches ? 0
=======================================
Hits ? 6212
Misses ? 9509
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
```swift | ||
let valkeyClient = ValkeyClient(.hostname("localhost", port: 6379), logger: logger) | ||
try await withThrowingTaskgroup(of: Void.self) { group in | ||
try await withThrowingTaskGroup(of: Void.self) { group in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:chefs-kiss:
try await withThrowingTaskGroup(of: Void.self) { group in | |
try await withThrowingDiscardingTaskGroup { group in |
public let keys: [ValkeyKey] | ||
|
||
public init(fromRESP token: RESPToken) throws { | ||
let (cursor, keys) = try token.decodeArrayElements(as: (Int, [ValkeyKey]).self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use (self.cursor, self.keys) = ...
. You don't need the temporary variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change
While working on a sample project, I found it was really hard to parse the response of the
SCAN
andKEYS
commands.After talking to @adam-fowler, he told me about the
RESPTokenDecodable
protocol, which makes it really easy to implement type safe responses, so I added them.