本文整理匯總了Golang中github.com/gengo/grpc-gateway/runtime.PopulateFieldFromPath函數的典型用法代碼示例。如果您正苦於以下問題:Golang PopulateFieldFromPath函數的具體用法?Golang PopulateFieldFromPath怎麽用?Golang PopulateFieldFromPath使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了PopulateFieldFromPath函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: request_Api_GetFile_0
func request_Api_GetFile_0(ctx context.Context, client ApiClient, req *http.Request, pathParams map[string]string) (Api_GetFileClient, error) {
var protoReq GetFileRequest
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["path.commit.repository.name"]
if !ok {
return nil, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "path.commit.repository.name")
}
err = runtime.PopulateFieldFromPath(&protoReq, "path.commit.repository.name", val)
if err != nil {
return nil, err
}
val, ok = pathParams["path.commit.id"]
if !ok {
return nil, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "path.commit.id")
}
err = runtime.PopulateFieldFromPath(&protoReq, "path.commit.id", val)
if err != nil {
return nil, err
}
val, ok = pathParams["path.path"]
if !ok {
return nil, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "path.path")
}
err = runtime.PopulateFieldFromPath(&protoReq, "path.path", val)
if err != nil {
return nil, err
}
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Api_GetFile_0); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, "%v", err)
}
return client.GetFile(ctx, &protoReq)
}
示例2: request_API_CreateRepo_0
func request_API_CreateRepo_0(ctx context.Context, client APIClient, req *http.Request, pathParams map[string]string) (proto.Message, error) {
var protoReq CreateRepoRequest
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["repo.name"]
if !ok {
return nil, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "repo.name")
}
err = runtime.PopulateFieldFromPath(&protoReq, "repo.name", val)
if err != nil {
return nil, err
}
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_API_CreateRepo_0); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, "%v", err)
}
return client.CreateRepo(ctx, &protoReq)
}
示例3: request_FlowCombination_RpcPathNestedStream_2
func request_FlowCombination_RpcPathNestedStream_2(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (FlowCombination_RpcPathNestedStreamClient, error) {
var protoReq NestedProto
if err := json.NewDecoder(req.Body).Decode(&protoReq.C); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["a.str"]
if !ok {
return nil, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str")
}
err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val)
if err != nil {
return nil, err
}
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathNestedStream_2); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, "%v", err)
}
return client.RpcPathNestedStream(ctx, &protoReq)
}
示例4: request_FlowCombination_RpcPathSingleNestedRpc_0
func request_FlowCombination_RpcPathSingleNestedRpc_0(ctx context.Context, client FlowCombinationClient, req *http.Request, pathParams map[string]string) (proto.Message, error) {
var protoReq SingleNestedProto
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["a.str"]
if !ok {
return nil, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "a.str")
}
err = runtime.PopulateFieldFromPath(&protoReq, "a.str", val)
if err != nil {
return nil, err
}
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_FlowCombination_RpcPathSingleNestedRpc_0); err != nil {
return nil, grpc.Errorf(codes.InvalidArgument, "%v", err)
}
return client.RpcPathSingleNestedRpc(ctx, &protoReq)
}
示例5: request_ABitOfEverythingService_DeepPathEcho_0
func request_ABitOfEverythingService_DeepPathEcho_0(ctx context.Context, marshaler runtime.Marshaler, client ABitOfEverythingServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ABitOfEverything
var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
}
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["single_nested.name"]
if !ok {
return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "single_nested.name")
}
err = runtime.PopulateFieldFromPath(&protoReq, "single_nested.name", val)
if err != nil {
return nil, metadata, err
}
msg, err := client.DeepPathEcho(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}