Example #1
0
func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	yym86 := z.DecBinary()
	_ = yym86
	if false {
	} else if z.HasExtensions() && z.DecExt(x) {
	} else {
		if r.IsContainerType(codecSelverValueTypeMap6669) {
			yyl87 := r.ReadMapStart()
			if yyl87 == 0 {
				r.ReadEnd()
			} else {
				x.codecDecodeSelfFromMap(yyl87, d)
			}
		} else if r.IsContainerType(codecSelverValueTypeArray6669) {
			yyl87 := r.ReadArrayStart()
			if yyl87 == 0 {
				r.ReadEnd()
			} else {
				x.codecDecodeSelfFromArray(yyl87, d)
			}
		} else {
			panic(codecSelferOnlyMapOrArrayEncodeToStructErr6669)
		}
	}
}
Example #2
0
func (x *RawResponse) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yys16Slc = z.DecScratchBuffer() // default slice to decode into
	_ = yys16Slc
	var yyhl16 bool = l >= 0
	for yyj16 := 0; ; yyj16++ {
		if yyhl16 {
			if yyj16 >= l {
				break
			}
		} else {
			if r.CheckBreak() {
				break
			}
		}
		yys16Slc = r.DecodeBytes(yys16Slc, true, true)
		yys16 := string(yys16Slc)
		switch yys16 {
		case "StatusCode":
			if r.TryDecodeAsNil() {
				x.StatusCode = 0
			} else {
				x.StatusCode = int(r.DecodeInt(codecSelferBitsize6669))
			}
		case "Body":
			if r.TryDecodeAsNil() {
				x.Body = nil
			} else {
				yyv18 := &x.Body
				yym19 := z.DecBinary()
				_ = yym19
				if false {
				} else {
					*yyv18 = r.DecodeBytes(*(*[]byte)(yyv18), false, false)
				}
			}
		case "Header":
			if r.TryDecodeAsNil() {
				x.Header = nil
			} else {
				yyv20 := &x.Header
				yym21 := z.DecBinary()
				_ = yym21
				if false {
				} else if z.HasExtensions() && z.DecExt(yyv20) {
				} else {
					h.dechttp_Header((*pkg1_http.Header)(yyv20), d)
				}
			}
		default:
			z.DecStructFieldNotFound(-1, yys16)
		} // end switch yys16
	} // end for yyj16
	if !yyhl16 {
		r.ReadEnd()
	}
}
Example #3
0
func (x *responseType) CodecDecodeSelf(d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	yym2 := z.DecBinary()
	_ = yym2
	if false {
	} else if z.HasExtensions() && z.DecExt(x) {
	} else {
		*((*int)(x)) = int(r.DecodeInt(codecSelferBitsize6669))
	}
}
Example #4
0
func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	yym111 := z.DecBinary()
	_ = yym111
	if false {
	} else if z.HasExtensions() && z.DecExt(x) {
	} else {
		h.decNodes((*Nodes)(x), d)
	}
}
Example #5
0
func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yys88Slc = z.DecScratchBuffer() // default slice to decode into
	_ = yys88Slc
	var yyhl88 bool = l >= 0
	for yyj88 := 0; ; yyj88++ {
		if yyhl88 {
			if yyj88 >= l {
				break
			}
		} else {
			if r.CheckBreak() {
				break
			}
		}
		yys88Slc = r.DecodeBytes(yys88Slc, true, true)
		yys88 := string(yys88Slc)
		switch yys88 {
		case "key":
			if r.TryDecodeAsNil() {
				x.Key = ""
			} else {
				x.Key = string(r.DecodeString())
			}
		case "value":
			if r.TryDecodeAsNil() {
				x.Value = ""
			} else {
				x.Value = string(r.DecodeString())
			}
		case "dir":
			if r.TryDecodeAsNil() {
				x.Dir = false
			} else {
				x.Dir = bool(r.DecodeBool())
			}
		case "expiration":
			if r.TryDecodeAsNil() {
				if x.Expiration != nil {
					x.Expiration = nil
				}
			} else {
				if x.Expiration == nil {
					x.Expiration = new(time.Time)
				}
				yym93 := z.DecBinary()
				_ = yym93
				if false {
				} else if yym94 := z.TimeRtidIfBinc(); yym94 != 0 {
					r.DecodeBuiltin(yym94, x.Expiration)
				} else if z.HasExtensions() && z.DecExt(x.Expiration) {
				} else if yym93 {
					z.DecBinaryUnmarshal(x.Expiration)
				} else if !yym93 && z.IsJSONHandle() {
					z.DecJSONUnmarshal(x.Expiration)
				} else {
					z.DecFallback(x.Expiration, false)
				}
			}
		case "ttl":
			if r.TryDecodeAsNil() {
				x.TTL = 0
			} else {
				x.TTL = int64(r.DecodeInt(64))
			}
		case "nodes":
			if r.TryDecodeAsNil() {
				x.Nodes = nil
			} else {
				yyv96 := &x.Nodes
				yyv96.CodecDecodeSelf(d)
			}
		case "modifiedIndex":
			if r.TryDecodeAsNil() {
				x.ModifiedIndex = 0
			} else {
				x.ModifiedIndex = uint64(r.DecodeUint(64))
			}
		case "createdIndex":
			if r.TryDecodeAsNil() {
				x.CreatedIndex = 0
			} else {
				x.CreatedIndex = uint64(r.DecodeUint(64))
			}
		default:
			z.DecStructFieldNotFound(-1, yys88)
		} // end switch yys88
	} // end for yyj88
	if !yyhl88 {
		r.ReadEnd()
	}
}
Example #6
0
func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yyj53 int
	var yyb53 bool
	var yyhl53 bool = l >= 0
	yyj53++
	if yyhl53 {
		yyb53 = yyj53 > l
	} else {
		yyb53 = r.CheckBreak()
	}
	if yyb53 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Action = ""
	} else {
		x.Action = string(r.DecodeString())
	}
	yyj53++
	if yyhl53 {
		yyb53 = yyj53 > l
	} else {
		yyb53 = r.CheckBreak()
	}
	if yyb53 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		if x.Node != nil {
			x.Node = nil
		}
	} else {
		if x.Node == nil {
			x.Node = new(Node)
		}
		x.Node.CodecDecodeSelf(d)
	}
	yyj53++
	if yyhl53 {
		yyb53 = yyj53 > l
	} else {
		yyb53 = r.CheckBreak()
	}
	if yyb53 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		if x.PrevNode != nil {
			x.PrevNode = nil
		}
	} else {
		if x.PrevNode == nil {
			x.PrevNode = new(Node)
		}
		x.PrevNode.CodecDecodeSelf(d)
	}
	yyj53++
	if yyhl53 {
		yyb53 = yyj53 > l
	} else {
		yyb53 = r.CheckBreak()
	}
	if yyb53 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.EtcdIndex = 0
	} else {
		x.EtcdIndex = uint64(r.DecodeUint(64))
	}
	yyj53++
	if yyhl53 {
		yyb53 = yyj53 > l
	} else {
		yyb53 = r.CheckBreak()
	}
	if yyb53 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.RaftIndex = 0
	} else {
		x.RaftIndex = uint64(r.DecodeUint(64))
	}
	yyj53++
	if yyhl53 {
		yyb53 = yyj53 > l
	} else {
		yyb53 = r.CheckBreak()
	}
	if yyb53 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.RaftTerm = 0
	} else {
		x.RaftTerm = uint64(r.DecodeUint(64))
	}
	for {
		yyj53++
		if yyhl53 {
			yyb53 = yyj53 > l
		} else {
			yyb53 = r.CheckBreak()
		}
		if yyb53 {
			break
		}
		z.DecStructFieldNotFound(yyj53-1, "")
	}
	r.ReadEnd()
}
Example #7
0
func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yys46Slc = z.DecScratchBuffer() // default slice to decode into
	_ = yys46Slc
	var yyhl46 bool = l >= 0
	for yyj46 := 0; ; yyj46++ {
		if yyhl46 {
			if yyj46 >= l {
				break
			}
		} else {
			if r.CheckBreak() {
				break
			}
		}
		yys46Slc = r.DecodeBytes(yys46Slc, true, true)
		yys46 := string(yys46Slc)
		switch yys46 {
		case "action":
			if r.TryDecodeAsNil() {
				x.Action = ""
			} else {
				x.Action = string(r.DecodeString())
			}
		case "node":
			if r.TryDecodeAsNil() {
				if x.Node != nil {
					x.Node = nil
				}
			} else {
				if x.Node == nil {
					x.Node = new(Node)
				}
				x.Node.CodecDecodeSelf(d)
			}
		case "prevNode":
			if r.TryDecodeAsNil() {
				if x.PrevNode != nil {
					x.PrevNode = nil
				}
			} else {
				if x.PrevNode == nil {
					x.PrevNode = new(Node)
				}
				x.PrevNode.CodecDecodeSelf(d)
			}
		case "etcdIndex":
			if r.TryDecodeAsNil() {
				x.EtcdIndex = 0
			} else {
				x.EtcdIndex = uint64(r.DecodeUint(64))
			}
		case "raftIndex":
			if r.TryDecodeAsNil() {
				x.RaftIndex = 0
			} else {
				x.RaftIndex = uint64(r.DecodeUint(64))
			}
		case "raftTerm":
			if r.TryDecodeAsNil() {
				x.RaftTerm = 0
			} else {
				x.RaftTerm = uint64(r.DecodeUint(64))
			}
		default:
			z.DecStructFieldNotFound(-1, yys46)
		} // end switch yys46
	} // end for yyj46
	if !yyhl46 {
		r.ReadEnd()
	}
}
Example #8
0
func (x *RawResponse) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yyj22 int
	var yyb22 bool
	var yyhl22 bool = l >= 0
	yyj22++
	if yyhl22 {
		yyb22 = yyj22 > l
	} else {
		yyb22 = r.CheckBreak()
	}
	if yyb22 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.StatusCode = 0
	} else {
		x.StatusCode = int(r.DecodeInt(codecSelferBitsize6669))
	}
	yyj22++
	if yyhl22 {
		yyb22 = yyj22 > l
	} else {
		yyb22 = r.CheckBreak()
	}
	if yyb22 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Body = nil
	} else {
		yyv24 := &x.Body
		yym25 := z.DecBinary()
		_ = yym25
		if false {
		} else {
			*yyv24 = r.DecodeBytes(*(*[]byte)(yyv24), false, false)
		}
	}
	yyj22++
	if yyhl22 {
		yyb22 = yyj22 > l
	} else {
		yyb22 = r.CheckBreak()
	}
	if yyb22 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Header = nil
	} else {
		yyv26 := &x.Header
		yym27 := z.DecBinary()
		_ = yym27
		if false {
		} else if z.HasExtensions() && z.DecExt(yyv26) {
		} else {
			h.dechttp_Header((*pkg1_http.Header)(yyv26), d)
		}
	}
	for {
		yyj22++
		if yyhl22 {
			yyb22 = yyj22 > l
		} else {
			yyb22 = r.CheckBreak()
		}
		if yyb22 {
			break
		}
		z.DecStructFieldNotFound(yyj22-1, "")
	}
	r.ReadEnd()
}
Example #9
0
func (x codecSelfer6669) decNodes(v *Nodes, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r

	yyv123 := *v
	yyh123, yyl123 := z.DecSliceHelperStart()

	var yyc123 bool
	_ = yyc123

	if yyv123 == nil {
		if yyl123 <= 0 {
			yyv123 = make(Nodes, 0)
		} else {
			yyv123 = make(Nodes, yyl123)
		}
		yyc123 = true
	}

	if yyl123 == 0 {
		if len(yyv123) != 0 {
			yyv123 = yyv123[:0]
			yyc123 = true
		}
	} else if yyl123 > 0 {

		yyn123 := yyl123
		if yyl123 > cap(yyv123) {
			yyv123 = make([]*Node, yyl123, yyl123)
			yyc123 = true

		} else if yyl123 != len(yyv123) {
			yyv123 = yyv123[:yyl123]
			yyc123 = true
		}
		yyj123 := 0
		for ; yyj123 < yyn123; yyj123++ {
			if r.TryDecodeAsNil() {
				if yyv123[yyj123] != nil {
					*yyv123[yyj123] = Node{}
				}
			} else {
				if yyv123[yyj123] == nil {
					yyv123[yyj123] = new(Node)
				}
				yyw124 := yyv123[yyj123]
				yyw124.CodecDecodeSelf(d)
			}

		}

	} else {
		for yyj123 := 0; !r.CheckBreak(); yyj123++ {
			if yyj123 >= len(yyv123) {
				yyv123 = append(yyv123, nil) // var yyz123 *Node
				yyc123 = true
			}

			if yyj123 < len(yyv123) {
				if r.TryDecodeAsNil() {
					if yyv123[yyj123] != nil {
						*yyv123[yyj123] = Node{}
					}
				} else {
					if yyv123[yyj123] == nil {
						yyv123[yyj123] = new(Node)
					}
					yyw125 := yyv123[yyj123]
					yyw125.CodecDecodeSelf(d)
				}

			} else {
				z.DecSwallow()
			}

		}
		yyh123.End()
	}
	if yyc123 {
		*v = yyv123
	}

}
Example #10
0
func (x codecSelfer6669) dechttp_Header(v *pkg1_http.Header, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r

	yyv115 := *v
	yyl115 := r.ReadMapStart()
	if yyv115 == nil {
		if yyl115 > 0 {
			yyv115 = make(map[string][]string, yyl115)
		} else {
			yyv115 = make(map[string][]string) // supports indefinite-length, etc
		}
		*v = yyv115
	}
	if yyl115 > 0 {
		for yyj115 := 0; yyj115 < yyl115; yyj115++ {
			var yymk115 string
			if r.TryDecodeAsNil() {
				yymk115 = ""
			} else {
				yymk115 = string(r.DecodeString())
			}

			yymv115 := yyv115[yymk115]
			if r.TryDecodeAsNil() {
				yymv115 = nil
			} else {
				yyv117 := &yymv115
				yym118 := z.DecBinary()
				_ = yym118
				if false {
				} else {
					z.F.DecSliceStringX(yyv117, false, d)
				}
			}

			if yyv115 != nil {
				yyv115[yymk115] = yymv115
			}
		}
	} else if yyl115 < 0 {
		for yyj115 := 0; !r.CheckBreak(); yyj115++ {
			var yymk115 string
			if r.TryDecodeAsNil() {
				yymk115 = ""
			} else {
				yymk115 = string(r.DecodeString())
			}

			yymv115 := yyv115[yymk115]
			if r.TryDecodeAsNil() {
				yymv115 = nil
			} else {
				yyv120 := &yymv115
				yym121 := z.DecBinary()
				_ = yym121
				if false {
				} else {
					z.F.DecSliceStringX(yyv120, false, d)
				}
			}

			if yyv115 != nil {
				yyv115[yymk115] = yymv115
			}
		}
		r.ReadEnd()
	} // else len==0: TODO: Should we clear map entries?
}
Example #11
0
func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
	var h codecSelfer6669
	z, r := codec1978.GenHelperDecoder(d)
	_, _, _ = h, z, r
	var yyj99 int
	var yyb99 bool
	var yyhl99 bool = l >= 0
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Key = ""
	} else {
		x.Key = string(r.DecodeString())
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Value = ""
	} else {
		x.Value = string(r.DecodeString())
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Dir = false
	} else {
		x.Dir = bool(r.DecodeBool())
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		if x.Expiration != nil {
			x.Expiration = nil
		}
	} else {
		if x.Expiration == nil {
			x.Expiration = new(time.Time)
		}
		yym104 := z.DecBinary()
		_ = yym104
		if false {
		} else if yym105 := z.TimeRtidIfBinc(); yym105 != 0 {
			r.DecodeBuiltin(yym105, x.Expiration)
		} else if z.HasExtensions() && z.DecExt(x.Expiration) {
		} else if yym104 {
			z.DecBinaryUnmarshal(x.Expiration)
		} else if !yym104 && z.IsJSONHandle() {
			z.DecJSONUnmarshal(x.Expiration)
		} else {
			z.DecFallback(x.Expiration, false)
		}
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.TTL = 0
	} else {
		x.TTL = int64(r.DecodeInt(64))
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.Nodes = nil
	} else {
		yyv107 := &x.Nodes
		yyv107.CodecDecodeSelf(d)
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.ModifiedIndex = 0
	} else {
		x.ModifiedIndex = uint64(r.DecodeUint(64))
	}
	yyj99++
	if yyhl99 {
		yyb99 = yyj99 > l
	} else {
		yyb99 = r.CheckBreak()
	}
	if yyb99 {
		r.ReadEnd()
		return
	}
	if r.TryDecodeAsNil() {
		x.CreatedIndex = 0
	} else {
		x.CreatedIndex = uint64(r.DecodeUint(64))
	}
	for {
		yyj99++
		if yyhl99 {
			yyb99 = yyj99 > l
		} else {
			yyb99 = r.CheckBreak()
		}
		if yyb99 {
			break
		}
		z.DecStructFieldNotFound(yyj99-1, "")
	}
	r.ReadEnd()
}