当前位置: 首页>>代码示例>>Golang>>正文


Golang runtime.PopulateFieldFromPath函数代码示例

本文整理汇总了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)
}
开发者ID:kunthar,项目名称:pachyderm,代码行数:49,代码来源:pfs.pb.gw.go

示例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)
}
开发者ID:angelabier1,项目名称:pachyderm,代码行数:27,代码来源:pfs.pb.gw.go

示例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)
}
开发者ID:JohanSJA,项目名称:grpc-gateway,代码行数:31,代码来源:flow_combination.pb.gw.go

示例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)
}
开发者ID:JohanSJA,项目名称:grpc-gateway,代码行数:27,代码来源:flow_combination.pb.gw.go

示例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

}
开发者ID:digitalfishpond,项目名称:dashboard,代码行数:30,代码来源:a_bit_of_everything.pb.gw.go


注:本文中的github.com/gengo/grpc-gateway/runtime.PopulateFieldFromPath函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。