當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。