func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r if r.IsContainerType(codecSelverValueTypeMap1819) { yyl23 := r.ReadMapStart() if yyl23 == 0 { r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl23, d) } } else if r.IsContainerType(codecSelverValueTypeArray1819) { yyl23 := r.ReadArrayStart() if yyl23 == 0 { r.ReadArrayEnd() } else { x.codecDecodeSelfFromArray(yyl23, d) } } else { panic(codecSelferOnlyMapOrArrayEncodeToStructErr1819) } }
func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r yyv43 := *v yyh43, yyl43 := z.DecSliceHelperStart() var yyc43 bool _ = yyc43 if yyv43 == nil { if yyl43 <= 0 { yyv43 = make(Nodes, 0) } else { yyv43 = make(Nodes, yyl43) } yyc43 = true } if yyl43 == 0 { if len(yyv43) != 0 { yyv43 = yyv43[:0] yyc43 = true } } else if yyl43 > 0 { yyn43 := yyl43 if yyl43 > cap(yyv43) { yyv43 = make([]*Node, yyl43, yyl43) yyc43 = true } else if yyl43 != len(yyv43) { yyv43 = yyv43[:yyl43] yyc43 = true } yyj43 := 0 for ; yyj43 < yyn43; yyj43++ { if r.TryDecodeAsNil() { if yyv43[yyj43] != nil { *yyv43[yyj43] = Node{} } } else { if yyv43[yyj43] == nil { yyv43[yyj43] = new(Node) } yyw44 := yyv43[yyj43] yyw44.CodecDecodeSelf(d) } } } else { for yyj43 := 0; !r.CheckBreak(); yyj43++ { if yyj43 >= len(yyv43) { yyv43 = append(yyv43, nil) // var yyz43 *Node yyc43 = true } if yyj43 > 0 { yyh43.Sep(yyj43) } if yyj43 < len(yyv43) { if r.TryDecodeAsNil() { if yyv43[yyj43] != nil { *yyv43[yyj43] = Node{} } } else { if yyv43[yyj43] == nil { yyv43[yyj43] = new(Node) } yyw45 := yyv43[yyj43] yyw45.CodecDecodeSelf(d) } } else { z.DecSwallow() } } yyh43.End() } if yyc43 { *v = yyv43 } }
func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r h.decNodes((*Nodes)(x), d) }
func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj33 int var yyb33 bool var yyhl33 bool = l >= 0 yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } if r.TryDecodeAsNil() { x.Key = "" } else { x.Key = string(r.DecodeString()) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { x.Dir = false } else { x.Dir = bool(r.DecodeBool()) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { x.Value = "" } else { x.Value = string(r.DecodeString()) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { x.Nodes = nil } else { yyv37 := &x.Nodes yyv37.CodecDecodeSelf(d) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { x.CreatedIndex = 0 } else { x.CreatedIndex = uint64(r.DecodeUint(64)) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { x.ModifiedIndex = 0 } else { x.ModifiedIndex = uint64(r.DecodeUint(64)) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { if x.Expiration != nil { x.Expiration = nil } } else { if x.Expiration == nil { x.Expiration = new(time.Time) } z.DecFallback(x.Expiration, false) } yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { x.TTL = 0 } else { x.TTL = int64(r.DecodeInt(64)) } for { yyj33++ if yyhl33 { yyb33 = yyj33 > l } else { yyb33 = r.CheckBreak() } if yyb33 { break } if yyj33 > 1 { r.ReadArrayEntrySeparator() } z.DecStructFieldNotFound(yyj33-1, "") } r.ReadArrayEnd() }
func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yys24Slc = z.DecScratchBuffer() // default slice to decode into _ = yys24Slc var yyhl24 bool = l >= 0 for yyj24 := 0; ; yyj24++ { if yyhl24 { if yyj24 >= l { break } } else { if r.CheckBreak() { break } if yyj24 > 0 { r.ReadMapEntrySeparator() } } yys24Slc = r.DecodeBytes(yys24Slc, true, true) yys24 := string(yys24Slc) if !yyhl24 { r.ReadMapKVSeparator() } switch yys24 { case "key": if r.TryDecodeAsNil() { x.Key = "" } else { x.Key = string(r.DecodeString()) } case "dir": if r.TryDecodeAsNil() { x.Dir = false } else { x.Dir = bool(r.DecodeBool()) } case "value": if r.TryDecodeAsNil() { x.Value = "" } else { x.Value = string(r.DecodeString()) } case "nodes": if r.TryDecodeAsNil() { x.Nodes = nil } else { yyv28 := &x.Nodes yyv28.CodecDecodeSelf(d) } case "createdIndex": if r.TryDecodeAsNil() { x.CreatedIndex = 0 } else { x.CreatedIndex = uint64(r.DecodeUint(64)) } case "modifiedIndex": if r.TryDecodeAsNil() { x.ModifiedIndex = 0 } else { x.ModifiedIndex = uint64(r.DecodeUint(64)) } case "expiration": if r.TryDecodeAsNil() { if x.Expiration != nil { x.Expiration = nil } } else { if x.Expiration == nil { x.Expiration = new(time.Time) } z.DecFallback(x.Expiration, false) } case "ttl": if r.TryDecodeAsNil() { x.TTL = 0 } else { x.TTL = int64(r.DecodeInt(64)) } default: z.DecStructFieldNotFound(-1, yys24) } // end switch yys24 } // end for yyj24 if !yyhl24 { r.ReadMapEnd() } }
func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj10 int var yyb10 bool var yyhl10 bool = l >= 0 yyj10++ if yyhl10 { yyb10 = yyj10 > l } else { yyb10 = r.CheckBreak() } if yyb10 { r.ReadArrayEnd() return } if r.TryDecodeAsNil() { x.Action = "" } else { x.Action = string(r.DecodeString()) } yyj10++ if yyhl10 { yyb10 = yyj10 > l } else { yyb10 = r.CheckBreak() } if yyb10 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { if x.Node != nil { x.Node = nil } } else { if x.Node == nil { x.Node = new(Node) } x.Node.CodecDecodeSelf(d) } yyj10++ if yyhl10 { yyb10 = yyj10 > l } else { yyb10 = r.CheckBreak() } if yyb10 { r.ReadArrayEnd() return } r.ReadArrayEntrySeparator() if r.TryDecodeAsNil() { if x.PrevNode != nil { x.PrevNode = nil } } else { if x.PrevNode == nil { x.PrevNode = new(Node) } x.PrevNode.CodecDecodeSelf(d) } for { yyj10++ if yyhl10 { yyb10 = yyj10 > l } else { yyb10 = r.CheckBreak() } if yyb10 { break } if yyj10 > 1 { r.ReadArrayEntrySeparator() } z.DecStructFieldNotFound(yyj10-1, "") } r.ReadArrayEnd() }
func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { var h codecSelfer1819 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yys6Slc = z.DecScratchBuffer() // default slice to decode into _ = yys6Slc var yyhl6 bool = l >= 0 for yyj6 := 0; ; yyj6++ { if yyhl6 { if yyj6 >= l { break } } else { if r.CheckBreak() { break } if yyj6 > 0 { r.ReadMapEntrySeparator() } } yys6Slc = r.DecodeBytes(yys6Slc, true, true) yys6 := string(yys6Slc) if !yyhl6 { r.ReadMapKVSeparator() } switch yys6 { 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) } default: z.DecStructFieldNotFound(-1, yys6) } // end switch yys6 } // end for yyj6 if !yyhl6 { r.ReadMapEnd() } }