aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorAlex <i@neonxp.dev>2022-06-30 19:12:28 +0300
committerGitHub <noreply@github.com>2022-06-30 19:12:28 +0300
commit3d69d1e7eabf8dbf1cb502a87787fe9ed120edc8 (patch)
tree0c1b7a657b5e019484e935996323420874b5ef57 /example
parent058331685cbdb73a4610110eb5599c0628e51c26 (diff)
parent7c86c2bfcf7be89492bc3df54ad3aaaf8a589043 (diff)
Merge pull request #3 from jon4hz/feat-no-paramsv1.2.0
feat: add wrapper supporting no request params
Diffstat (limited to 'example')
-rw-r--r--example/main.go5
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"`