diff options
author | jon4hz <me@jon4hz.io> | 2022-06-28 19:55:30 +0300 |
---|---|---|
committer | jon4hz <me@jon4hz.io> | 2022-06-28 19:55:30 +0300 |
commit | 40ab2c6e61d8fcaddf7daac1cc7919f949c44124 (patch) | |
tree | 3448b0c3d7569af25ee5579d3ed2c0f3d077b58f /example/main.go | |
parent | c39fcbc6a153b11354fa46e69a332ebc3774fdcb (diff) |
feat: add wrapper supporting no request params
Diffstat (limited to 'example/main.go')
-rw-r--r-- | example/main.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/example/main.go b/example/main.go index 37b9037..1c9fa41 100644 --- a/example/main.go +++ b/example/main.go @@ -79,6 +79,7 @@ func main() { s.Register("multiply", rpc.H(Multiply)) s.Register("divide", rpc.H(Divide)) + s.Register("hello", rpc.HS(Hello)) ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill) defer cancel() @@ -102,6 +103,10 @@ func Divide(ctx context.Context, args *Args) (*Quotient, error) { return quo, nil } +func Hello(ctx context.Context) (string, error) { + return "world", nil +} + type Args struct { A int `json:"a"` B int `json:"b"` |