-
Notifications
You must be signed in to change notification settings - Fork 34
/
encode_decode.go
34 lines (29 loc) · 1.06 KB
/
encode_decode.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Code generated by goa v3.16.2, DO NOT EDIT.
//
// calc go-kit HTTP server encoders and decoders
//
// Command:
// $ goa gen goa.design/plugins/v3/goakit/examples/calc/design -o
// $(GOPATH)/src/goa.design/plugins/goakit/examples/calc
package server
import (
"context"
"net/http"
kithttp "github.com/go-kit/kit/transport/http"
goahttp "goa.design/goa/v3/http"
"goa.design/plugins/v3/goakit/examples/calc/gen/http/calc/server"
)
// EncodeAddResponse returns a go-kit EncodeResponseFunc suitable for encoding
// calc add responses.
func EncodeAddResponse(encoder func(context.Context, http.ResponseWriter) goahttp.Encoder) kithttp.EncodeResponseFunc {
return server.EncodeAddResponse(encoder)
}
// DecodeAddRequest returns a go-kit DecodeRequestFunc suitable for decoding
// calc add requests.
func DecodeAddRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) kithttp.DecodeRequestFunc {
dec := server.DecodeAddRequest(mux, decoder)
return func(ctx context.Context, r *http.Request) (interface{}, error) {
r = r.WithContext(ctx)
return dec(r)
}
}