本文整理汇总了Golang中go/uber/org/thriftrw/wire.Value.GetStruct方法的典型用法代码示例。如果您正苦于以下问题:Golang Value.GetStruct方法的具体用法?Golang Value.GetStruct怎么用?Golang Value.GetStruct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类go/uber/org/thriftrw/wire.Value
的用法示例。
在下文中一共展示了Value.GetStruct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例2: FromWire
func (v *Cache_Clear_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
示例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
}
示例4: FromWire
func (v *KeyValue_SetValue_Result) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
示例5: FromWire
func (v *NonStandardServiceName_NonStandardFunctionName_Result) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
示例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
}
示例7: FromWire
func (v *ThriftTest_TestVoid_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例13: FromWire
func (v *SecondService_BlahBlah_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}
示例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
}
示例15: FromWire
func (v *Plugin_Goodbye_Args) FromWire(w wire.Value) error {
for _, field := range w.GetStruct().Fields {
switch field.ID {
}
}
return nil
}