MCPcopy Create free account
hub / github.com/Sifchain/sifnode / RegisterQueryHandlerClient

Function RegisterQueryHandlerClient

x/margin/types/query.pb.gw.go:587–730  ·  view source on GitHub ↗

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go thro

(ctx context.Context, mux *runtime.ServeMux, client QueryClient)

Source from the content-addressed store, hash-verified

585// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
586// "QueryClient" to call the correct interceptors.
587func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error {
588
589 mux.Handle("GET", pattern_Query_GetPositions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
590 ctx, cancel := context.WithCancel(req.Context())
591 defer cancel()
592 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
593 rctx, err := runtime.AnnotateContext(ctx, mux, req)
594 if err != nil {
595 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
596 return
597 }
598 resp, md, err := request_Query_GetPositions_0(rctx, inboundMarshaler, client, req, pathParams)
599 ctx = runtime.NewServerMetadataContext(ctx, md)
600 if err != nil {
601 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
602 return
603 }
604
605 forward_Query_GetPositions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
606
607 })
608
609 mux.Handle("GET", pattern_Query_GetPositionsForAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
610 ctx, cancel := context.WithCancel(req.Context())
611 defer cancel()
612 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
613 rctx, err := runtime.AnnotateContext(ctx, mux, req)
614 if err != nil {
615 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
616 return
617 }
618 resp, md, err := request_Query_GetPositionsForAddress_0(rctx, inboundMarshaler, client, req, pathParams)
619 ctx = runtime.NewServerMetadataContext(ctx, md)
620 if err != nil {
621 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
622 return
623 }
624
625 forward_Query_GetPositionsForAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
626
627 })
628
629 mux.Handle("GET", pattern_Query_GetPositionsByPool_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
630 ctx, cancel := context.WithCancel(req.Context())
631 defer cancel()
632 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
633 rctx, err := runtime.AnnotateContext(ctx, mux, req)
634 if err != nil {
635 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
636 return
637 }
638 resp, md, err := request_Query_GetPositionsByPool_0(rctx, inboundMarshaler, client, req, pathParams)
639 ctx = runtime.NewServerMetadataContext(ctx, md)
640 if err != nil {
641 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
642 return
643 }
644

Callers 2

RegisterQueryHandlerFunction · 0.70

Tested by

no test coverage detected