本文整理汇总了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
}