1// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. 2 3package vegeta 4 5import ( 6 json "encoding/json" 7 easyjson "github.com/mailru/easyjson" 8 jlexer "github.com/mailru/easyjson/jlexer" 9 jwriter "github.com/mailru/easyjson/jwriter" 10 http "net/http" 11 time "time" 12) 13 14// suppress unused package warning 15var ( 16 _ *json.RawMessage 17 _ *jlexer.Lexer 18 _ *jwriter.Writer 19 _ easyjson.Marshaler 20) 21 22func easyjsonBd1621b8DecodeGithubComTsenartVegetaV12Lib(in *jlexer.Lexer, out *jsonResult) { 23 isTopLevel := in.IsStart() 24 if in.IsNull() { 25 if isTopLevel { 26 in.Consumed() 27 } 28 in.Skip() 29 return 30 } 31 in.Delim('{') 32 for !in.IsDelim('}') { 33 key := in.UnsafeString() 34 in.WantColon() 35 if in.IsNull() { 36 in.Skip() 37 in.WantComma() 38 continue 39 } 40 switch key { 41 case "attack": 42 out.Attack = string(in.String()) 43 case "seq": 44 out.Seq = uint64(in.Uint64()) 45 case "code": 46 out.Code = uint16(in.Uint16()) 47 case "timestamp": 48 if data := in.Raw(); in.Ok() { 49 in.AddError((out.Timestamp).UnmarshalJSON(data)) 50 } 51 case "latency": 52 out.Latency = time.Duration(in.Int64()) 53 case "bytes_out": 54 out.BytesOut = uint64(in.Uint64()) 55 case "bytes_in": 56 out.BytesIn = uint64(in.Uint64()) 57 case "error": 58 out.Error = string(in.String()) 59 case "body": 60 if in.IsNull() { 61 in.Skip() 62 out.Body = nil 63 } else { 64 out.Body = in.Bytes() 65 } 66 case "method": 67 out.Method = string(in.String()) 68 case "url": 69 out.URL = string(in.String()) 70 case "headers": 71 if in.IsNull() { 72 in.Skip() 73 } else { 74 in.Delim('{') 75 if !in.IsDelim('}') { 76 out.Headers = make(http.Header) 77 } else { 78 out.Headers = nil 79 } 80 for !in.IsDelim('}') { 81 key := string(in.String()) 82 in.WantColon() 83 var v2 []string 84 if in.IsNull() { 85 in.Skip() 86 v2 = nil 87 } else { 88 in.Delim('[') 89 if v2 == nil { 90 if !in.IsDelim(']') { 91 v2 = make([]string, 0, 4) 92 } else { 93 v2 = []string{} 94 } 95 } else { 96 v2 = (v2)[:0] 97 } 98 for !in.IsDelim(']') { 99 var v3 string 100 v3 = string(in.String()) 101 v2 = append(v2, v3) 102 in.WantComma() 103 } 104 in.Delim(']') 105 } 106 (out.Headers)[key] = v2 107 in.WantComma() 108 } 109 in.Delim('}') 110 } 111 default: 112 in.SkipRecursive() 113 } 114 in.WantComma() 115 } 116 in.Delim('}') 117 if isTopLevel { 118 in.Consumed() 119 } 120} 121func easyjsonBd1621b8EncodeGithubComTsenartVegetaV12Lib(out *jwriter.Writer, in jsonResult) { 122 out.RawByte('{') 123 first := true 124 _ = first 125 { 126 const prefix string = ",\"attack\":" 127 out.RawString(prefix[1:]) 128 out.String(string(in.Attack)) 129 } 130 { 131 const prefix string = ",\"seq\":" 132 out.RawString(prefix) 133 out.Uint64(uint64(in.Seq)) 134 } 135 { 136 const prefix string = ",\"code\":" 137 out.RawString(prefix) 138 out.Uint16(uint16(in.Code)) 139 } 140 { 141 const prefix string = ",\"timestamp\":" 142 out.RawString(prefix) 143 out.Raw((in.Timestamp).MarshalJSON()) 144 } 145 { 146 const prefix string = ",\"latency\":" 147 out.RawString(prefix) 148 out.Int64(int64(in.Latency)) 149 } 150 { 151 const prefix string = ",\"bytes_out\":" 152 out.RawString(prefix) 153 out.Uint64(uint64(in.BytesOut)) 154 } 155 { 156 const prefix string = ",\"bytes_in\":" 157 out.RawString(prefix) 158 out.Uint64(uint64(in.BytesIn)) 159 } 160 { 161 const prefix string = ",\"error\":" 162 out.RawString(prefix) 163 out.String(string(in.Error)) 164 } 165 { 166 const prefix string = ",\"body\":" 167 out.RawString(prefix) 168 out.Base64Bytes(in.Body) 169 } 170 { 171 const prefix string = ",\"method\":" 172 out.RawString(prefix) 173 out.String(string(in.Method)) 174 } 175 { 176 const prefix string = ",\"url\":" 177 out.RawString(prefix) 178 out.String(string(in.URL)) 179 } 180 { 181 const prefix string = ",\"headers\":" 182 out.RawString(prefix) 183 if in.Headers == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { 184 out.RawString(`null`) 185 } else { 186 out.RawByte('{') 187 v6First := true 188 for v6Name, v6Value := range in.Headers { 189 if v6First { 190 v6First = false 191 } else { 192 out.RawByte(',') 193 } 194 out.String(string(v6Name)) 195 out.RawByte(':') 196 if v6Value == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { 197 out.RawString("null") 198 } else { 199 out.RawByte('[') 200 for v7, v8 := range v6Value { 201 if v7 > 0 { 202 out.RawByte(',') 203 } 204 out.String(string(v8)) 205 } 206 out.RawByte(']') 207 } 208 } 209 out.RawByte('}') 210 } 211 } 212 out.RawByte('}') 213} 214 215// MarshalEasyJSON supports easyjson.Marshaler interface 216func (v jsonResult) MarshalEasyJSON(w *jwriter.Writer) { 217 easyjsonBd1621b8EncodeGithubComTsenartVegetaV12Lib(w, v) 218} 219 220// UnmarshalEasyJSON supports easyjson.Unmarshaler interface 221func (v *jsonResult) UnmarshalEasyJSON(l *jlexer.Lexer) { 222 easyjsonBd1621b8DecodeGithubComTsenartVegetaV12Lib(l, v) 223} 224