本文整理汇总了Golang中go/uber/org/yarpc/encoding/thrift.Response类的典型用法代码示例。如果您正苦于以下问题:Golang Response类的具体用法?Golang Response怎么用?Golang Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Response类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Echo
func (h handler) Echo(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args echo.Echo_Echo_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
success, resMeta, err := h.impl.Echo(ctx, reqMeta, args.Ping)
hadError := err != nil
result, err := echo.Echo_Echo_Helper.WrapResponse(success, err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}
示例2: TestVoid
func (h handler) TestVoid(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args gauntlet.ThriftTest_TestVoid_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
resMeta, err := h.impl.TestVoid(ctx, reqMeta)
hadError := err != nil
result, err := gauntlet.ThriftTest_TestVoid_Helper.WrapResponse(err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}
示例3: SetValue
func (h handler) SetValue(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args kv.KeyValue_SetValue_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
resMeta, err := h.impl.SetValue(ctx, reqMeta, args.Key, args.Value)
hadError := err != nil
result, err := kv.KeyValue_SetValue_Helper.WrapResponse(err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}
示例4: SecondtestString
func (h handler) SecondtestString(
ctx context.Context,
reqMeta yarpc.ReqMeta,
body wire.Value,
) (thrift.Response, error) {
var args gauntlet.SecondService_SecondtestString_Args
if err := args.FromWire(body); err != nil {
return thrift.Response{}, err
}
success, resMeta, err := h.impl.SecondtestString(ctx, reqMeta, args.Thing)
hadError := err != nil
result, err := gauntlet.SecondService_SecondtestString_Helper.WrapResponse(success, err)
var response thrift.Response
if err == nil {
response.IsApplicationError = hadError
response.Meta = resMeta
response.Body = result
}
return response, err
}