本文整理汇总了Golang中go/uber/org/thriftrw/wire.Value类的典型用法代码示例。如果您正苦于以下问题:Golang Value类的具体用法?Golang Value怎么用?Golang Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Value类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: FromWire
func (v *ConflictingNamesSetValueArgs) FromWire(w wire.Value) error {
var err error
keyIsSet := false
valueIsSet := false
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TBinary {
v.Key, err = field.Value.GetString(), error(nil)
if err != nil {
return err
}
keyIsSet = true
}
case 2:
if field.Value.Type() == wire.TBinary {
v.Value, err = field.Value.GetBinary(), error(nil)
if err != nil {
return err
}
valueIsSet = true
}
}
}
if !keyIsSet {
return errors.New("field Key of ConflictingNamesSetValueArgs is required")
}
if !valueIsSet {
return errors.New("field Value of ConflictingNamesSetValueArgs is required")
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:32,代码来源:types.go
示例2: FromWire
func (v *Cache_Clear_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:7,代码来源:cache_clear.go
示例3: FromWire
func (v *KeyValue_GetValue_Result) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 0:
if field.Value.Type() == wire.TStruct {
v.Success, err = _ArbitraryValue_Read(field.Value)
if err != nil {
return err
}
}
case 1:
if field.Value.Type() == wire.TStruct {
v.DoesNotExist, err = _DoesNotExistException_Read(field.Value)
if err != nil {
return err
}
}
}
}
count := 0
if v.Success != nil {
count++
}
if v.DoesNotExist != nil {
count++
}
if count != 1 {
return fmt.Errorf("KeyValue_GetValue_Result should have exactly one field: got %v fields", count)
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:32,代码来源:keyvalue_getvalue.go
示例4: FromWire
func (v *KeyValue_SetValue_Result) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:7,代码来源:keyvalue_setvalue.go
示例5: FromWire
func (v *NonStandardServiceName_NonStandardFunctionName_Result) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:7,代码来源:non_standard_service_name_non_standard_function_name.go
示例6: FromWire
func (v *KeyValue_SetValue_Args) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Key = &x
if err != nil {
return err
}
}
case 2:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Value = &x
if err != nil {
return err
}
}
}
}
return nil
}
开发者ID:yarpc,项目名称:yarpc-go,代码行数:26,代码来源:keyvalue_setvalue.go
示例7: FromWire
func (v *ThriftTest_TestVoid_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:yarpc,项目名称:yarpc-go,代码行数:7,代码来源:thrifttest_testvoid.go
示例8: FromWire
func (v *KeyValue_DeleteValue_Result) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TStruct {
v.DoesNotExist, err = _DoesNotExistException_Read(field.Value)
if err != nil {
return err
}
}
case 2:
if field.Value.Type() == wire.TStruct {
v.InternalError, err = _InternalError_Read(field.Value)
if err != nil {
return err
}
}
}
}
count := 0
if v.DoesNotExist != nil {
count++
}
if v.InternalError != nil {
count++
}
if count > 1 {
return fmt.Errorf("KeyValue_DeleteValue_Result should have at most one field: got %v fields", count)
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:32,代码来源:keyvalue_deletevalue.go
示例9: FromWire
func (v *KeyValue_GetValue_Result) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 0:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Success = &x
if err != nil {
return err
}
}
case 1:
if field.Value.Type() == wire.TStruct {
v.DoesNotExist, err = _ResourceDoesNotExist_Read(field.Value)
if err != nil {
return err
}
}
}
}
count := 0
if v.Success != nil {
count++
}
if v.DoesNotExist != nil {
count++
}
if count != 1 {
return fmt.Errorf("KeyValue_GetValue_Result should have exactly one field: got %v fields", count)
}
return nil
}
开发者ID:yarpc,项目名称:yarpc-go,代码行数:34,代码来源:keyvalue_getvalue.go
示例10: FromWire
func (v *KeyValue_SetValueV2_Args) FromWire(w wire.Value) error {
var err error
keyIsSet := false
valueIsSet := false
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TBinary {
v.Key, err = _Key_Read(field.Value)
if err != nil {
return err
}
keyIsSet = true
}
case 2:
if field.Value.Type() == wire.TStruct {
v.Value, err = _ArbitraryValue_Read(field.Value)
if err != nil {
return err
}
valueIsSet = true
}
}
}
if !keyIsSet {
return errors.New("field Key of KeyValue_SetValueV2_Args is required")
}
if !valueIsSet {
return errors.New("field Value of KeyValue_SetValueV2_Args is required")
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:32,代码来源:keyvalue_setvaluev2.go
示例11: FromWire
func (v *ThriftTest_TestMultiException_Args) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Arg0 = &x
if err != nil {
return err
}
}
case 2:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Arg1 = &x
if err != nil {
return err
}
}
}
}
return nil
}
开发者ID:yarpc,项目名称:yarpc-go,代码行数:26,代码来源:thrifttest_testmultiexception.go
示例12: FromWire
func (v *TApplicationException) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TBinary {
var x string
x, err = field.Value.GetString(), error(nil)
v.Message = &x
if err != nil {
return err
}
}
case 2:
if field.Value.Type() == wire.TI32 {
var x ExceptionType
x, err = _ExceptionType_Read(field.Value)
v.Type = &x
if err != nil {
return err
}
}
}
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:26,代码来源:types.go
示例13: FromWire
func (v *SecondService_BlahBlah_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:yarpc,项目名称:yarpc-go,代码行数:7,代码来源:secondservice_blahblah.go
示例14: FromWire
func (v *ThriftTest_TestMulti_Args) FromWire(w wire.Value) error {
var err error
for _, field := range w.GetStruct().Fields {
switch field.ID {
case 1:
if field.Value.Type() == wire.TI8 {
var x int8
x, err = field.Value.GetI8(), error(nil)
v.Arg0 = &x
if err != nil {
return err
}
}
case 2:
if field.Value.Type() == wire.TI32 {
var x int32
x, err = field.Value.GetI32(), error(nil)
v.Arg1 = &x
if err != nil {
return err
}
}
case 3:
if field.Value.Type() == wire.TI64 {
var x int64
x, err = field.Value.GetI64(), error(nil)
v.Arg2 = &x
if err != nil {
return err
}
}
case 4:
if field.Value.Type() == wire.TMap {
v.Arg3, err = _Map_I16_String_Read(field.Value.GetMap())
if err != nil {
return err
}
}
case 5:
if field.Value.Type() == wire.TI32 {
var x Numberz
x, err = _Numberz_Read(field.Value)
v.Arg4 = &x
if err != nil {
return err
}
}
case 6:
if field.Value.Type() == wire.TI64 {
var x UserId
x, err = _UserId_Read(field.Value)
v.Arg5 = &x
if err != nil {
return err
}
}
}
}
return nil
}
开发者ID:yarpc,项目名称:yarpc-go,代码行数:60,代码来源:thrifttest_testmulti.go
示例15: FromWire
func (v *Plugin_Goodbye_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:7,代码来源:plugin_goodbye.go
示例16: FromWire
func (v *HandshakeRequest) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
开发者ID:thriftrw,项目名称:thriftrw-go,代码行数:7,代码来源:types.go
注:本文中的go/uber/org/thriftrw/wire.Value类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论