elliotchance / elliotchance/jsonrpc
More natural handler prototypes
- Dominant language
- Go
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Allow the signature of a handler to reflect the incoming data. For example instead of:
```go
func sum(request jsonrpc.RequestResponder) jsonrpc.Response {
total := 0.0
for _, x := range request.Params().([]interface{}) {
total += x.(float64)
}
return request.NewSuccessResponse(total)
}
```
Use:
```go
func sum(nums ...float64) (interface{}, error) {
total := 0.0
for _, x := range nums {
total += x
}
return total, nil
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files, tests, or entry points. Start by tracing how handlers are registered and invoked, then compare that path with the two Go signatures shown; done means handlers can receive typed incoming data and return the demonstrated result and error form without the current request-level parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100