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


Golang runtime.String函数代码示例

本文整理汇总了Golang中github.com/grpc-ecosystem/grpc-gateway/runtime.String函数的典型用法代码示例。如果您正苦于以下问题:Golang String函数的具体用法?Golang String怎么用?Golang String使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了String函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: request_ApplicationManager_SetApplication_0

func request_ApplicationManager_SetApplication_0(ctx context.Context, marshaler runtime.Marshaler, client ApplicationManagerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq Application
	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["app_id"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "app_id")
	}

	protoReq.AppId, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.SetApplication(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:TheThingsNetwork,项目名称:ttn,代码行数:30,代码来源:handler.pb.gw.go

示例2: request_NodeSession_Update_0

func request_NodeSession_Update_0(ctx context.Context, marshaler runtime.Marshaler, client NodeSessionClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq UpdateNodeSessionRequest
	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["devAddr"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "devAddr")
	}

	protoReq.DevAddr, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:yuseunghyuk,项目名称:loraserver,代码行数:30,代码来源:nodeSession.pb.gw.go

示例3: request_EchoService_Echo_0

func request_EchoService_Echo_0(ctx context.Context, marshaler runtime.Marshaler, client EchoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq SimpleMessage
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["id"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "id")
	}

	protoReq.Id, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.Echo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:kubernetes,项目名称:dashboard,代码行数:26,代码来源:echo_service.pb.gw.go

示例4: request_Status_Logs_0

func request_Status_Logs_0(ctx context.Context, marshaler runtime.Marshaler, client StatusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq LogsRequest
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["node_id"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "node_id")
	}

	protoReq.NodeId, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Status_Logs_0); err != nil {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
	}

	msg, err := client.Logs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:knz,项目名称:cockroach,代码行数:30,代码来源:status.pb.gw.go

示例5: request_NodeSession_GetByDevEUI_0

func request_NodeSession_GetByDevEUI_0(ctx context.Context, marshaler runtime.Marshaler, client NodeSessionClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq GetNodeSessionByDevEUIRequest
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["devEUI"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "devEUI")
	}

	protoReq.DevEUI, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.GetByDevEUI(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:yuseunghyuk,项目名称:loraserver,代码行数:26,代码来源:nodeSession.pb.gw.go

示例6: request_Admin_DatabaseDetails_0

func request_Admin_DatabaseDetails_0(ctx context.Context, marshaler runtime.Marshaler, client AdminClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq DatabaseDetailsRequest
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["database"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "database")
	}

	protoReq.Database, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.DatabaseDetails(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:yangxuanjia,项目名称:cockroach,代码行数:26,代码来源:admin.pb.gw.go

示例7: request_Lightning_LookupInvoice_0

func request_Lightning_LookupInvoice_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq PaymentHash
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["r_hash_str"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "r_hash_str")
	}

	protoReq.RHashStr, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Lightning_LookupInvoice_0); err != nil {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "%v", err)
	}

	msg, err := client.LookupInvoice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:lightningnetwork,项目名称:lnd,代码行数:30,代码来源:rpc.pb.gw.go

示例8: request_Discovery_GetAll_0

func request_Discovery_GetAll_0(ctx context.Context, marshaler runtime.Marshaler, client DiscoveryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq GetServiceRequest
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["service_name"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "service_name")
	}

	protoReq.ServiceName, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.GetAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:TheThingsNetwork,项目名称:ttn,代码行数:26,代码来源:discovery.pb.gw.go

示例9: request_Node_ListByAppEUI_0

func request_Node_ListByAppEUI_0(ctx context.Context, marshaler runtime.Marshaler, client NodeClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq ListNodeByAppEUIRequest
	var metadata runtime.ServerMetadata

	var (
		val string
		ok  bool
		err error
		_   = err
	)

	val, ok = pathParams["appEUI"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "appEUI")
	}

	protoReq.AppEUI, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["offset"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "offset")
	}

	protoReq.Offset, err = runtime.Int64(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["limit"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "limit")
	}

	protoReq.Limit, err = runtime.Int64(val)

	if err != nil {
		return nil, metadata, err
	}

	msg, err := client.ListByAppEUI(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err

}
开发者ID:yuseunghyuk,项目名称:loraserver,代码行数:48,代码来源:node.pb.gw.go

示例10: request_ABitOfEverythingService_Create_0


//.........这里部分代码省略.........
	protoReq.Fixed64Value, err = runtime.Uint64(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["fixed32_value"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "fixed32_value")
	}

	protoReq.Fixed32Value, err = runtime.Uint32(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["bool_value"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "bool_value")
	}

	protoReq.BoolValue, err = runtime.Bool(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["string_value"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "string_value")
	}

	protoReq.StringValue, err = runtime.String(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["uint32_value"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "uint32_value")
	}

	protoReq.Uint32Value, err = runtime.Uint32(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["sfixed32_value"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed32_value")
	}

	protoReq.Sfixed32Value, err = runtime.Int32(val)

	if err != nil {
		return nil, metadata, err
	}

	val, ok = pathParams["sfixed64_value"]
	if !ok {
		return nil, metadata, grpc.Errorf(codes.InvalidArgument, "missing parameter %s", "sfixed64_value")
	}
开发者ID:kubernetes,项目名称:dashboard,代码行数:66,代码来源:a_bit_of_everything.pb.gw.go


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