-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace the Handler interface with a plain function type. (#90)
In practice there turns out to be no practical advantage to having the Handler type be an interface. All the existing usage that I can find, including in the handler support package, is based on explicit functions. This change replaces the Handler interface with a type alias to the expected function signature for the interface's Handle method. Any existing use based on the interface can be updated by extracting the method directly. For example, given a type like: type T struct{ ... func (t *T) Handle(ctx context.Context, req *jrpc2.Request) (any, error) { ... } h := &T{ ... } Replace usage like: m := handler.Map{"Method": h} with: m := handler.Map{"Method": h.Handle} This is a breaking change to the package API.
- Loading branch information
1 parent
4abecb2
commit 70c3cd8
Showing
6 changed files
with
39 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters