...

Source file src/github.com/go-kit/kit/transport/grpc/encode_decode.go

Documentation: github.com/go-kit/kit/transport/grpc

     1  package grpc
     2  
     3  import (
     4  	"context"
     5  )
     6  
     7  // DecodeRequestFunc extracts a user-domain request object from a gRPC request.
     8  // It's designed to be used in gRPC servers, for server-side endpoints. One
     9  // straightforward DecodeRequestFunc could be something that decodes from the
    10  // gRPC request message to the concrete request type.
    11  type DecodeRequestFunc func(context.Context, interface{}) (request interface{}, err error)
    12  
    13  // EncodeRequestFunc encodes the passed request object into the gRPC request
    14  // object. It's designed to be used in gRPC clients, for client-side endpoints.
    15  // One straightforward EncodeRequestFunc could something that encodes the object
    16  // directly to the gRPC request message.
    17  type EncodeRequestFunc func(context.Context, interface{}) (request interface{}, err error)
    18  
    19  // EncodeResponseFunc encodes the passed response object to the gRPC response
    20  // message. It's designed to be used in gRPC servers, for server-side endpoints.
    21  // One straightforward EncodeResponseFunc could be something that encodes the
    22  // object directly to the gRPC response message.
    23  type EncodeResponseFunc func(context.Context, interface{}) (response interface{}, err error)
    24  
    25  // DecodeResponseFunc extracts a user-domain response object from a gRPC
    26  // response object. It's designed to be used in gRPC clients, for client-side
    27  // endpoints. One straightforward DecodeResponseFunc could be something that
    28  // decodes from the gRPC response message to the concrete response type.
    29  type DecodeResponseFunc func(context.Context, interface{}) (response interface{}, err error)
    30  

View as plain text