| 1 |
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. |
| 2 |
|
| 3 |
package elastic |
| 4 |
|
| 5 |
import ( |
| 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 |
) |
| 11 |
|
| 12 |
// suppress unused package warning |
| 13 |
var ( |
| 14 |
_ *json.RawMessage |
| 15 |
_ *jlexer.Lexer |
| 16 |
_ *jwriter.Writer |
| 17 |
_ easyjson.Marshaler |
| 18 |
) |
| 19 |
|
| 20 |
func easyjson9de0fcbfDecodeGopkgInOlivereElasticV5(in *jlexer.Lexer, out *bulkIndexRequestCommandOp) { |
| 21 |
isTopLevel := in.IsStart() |
| 22 |
if in.IsNull() { |
| 23 |
if isTopLevel { |
| 24 |
in.Consumed() |
| 25 |
} |
| 26 |
in.Skip() |
| 27 |
return |
| 28 |
} |
| 29 |
in.Delim('{') |
| 30 |
for !in.IsDelim('}') { |
| 31 |
key := in.UnsafeString() |
| 32 |
in.WantColon() |
| 33 |
if in.IsNull() { |
| 34 |
in.Skip() |
| 35 |
in.WantComma() |
| 36 |
continue |
| 37 |
} |
| 38 |
switch key { |
| 39 |
case "_id": |
| 40 |
out.Id = string(in.String()) |
| 41 |
case "_index": |
| 42 |
out.Index = string(in.String()) |
| 43 |
case "_ttl": |
| 44 |
out.TTL = string(in.String()) |
| 45 |
case "_type": |
| 46 |
out.Type = string(in.String()) |
| 47 |
case "_parent": |
| 48 |
out.Parent = string(in.String()) |
| 49 |
case "_retry_on_conflict": |
| 50 |
if in.IsNull() { |
| 51 |
in.Skip() |
| 52 |
out.RetryOnConflict = nil |
| 53 |
} else { |
| 54 |
if out.RetryOnConflict == nil { |
| 55 |
out.RetryOnConflict = new(int) |
| 56 |
} |
| 57 |
*out.RetryOnConflict = int(in.Int()) |
| 58 |
} |
| 59 |
case "_routing": |
| 60 |
out.Routing = string(in.String()) |
| 61 |
case "_version": |
| 62 |
out.Version = int64(in.Int64()) |
| 63 |
case "_version_type": |
| 64 |
out.VersionType = string(in.String()) |
| 65 |
case "pipeline": |
| 66 |
out.Pipeline = string(in.String()) |
| 67 |
default: |
| 68 |
in.SkipRecursive() |
| 69 |
} |
| 70 |
in.WantComma() |
| 71 |
} |
| 72 |
in.Delim('}') |
| 73 |
if isTopLevel { |
| 74 |
in.Consumed() |
| 75 |
} |
| 76 |
} |
| 77 |
func easyjson9de0fcbfEncodeGopkgInOlivereElasticV5(out *jwriter.Writer, in bulkIndexRequestCommandOp) { |
| 78 |
out.RawByte('{') |
| 79 |
first := true |
| 80 |
_ = first |
| 81 |
if in.Id != "" { |
| 82 |
const prefix string = ",\"_id\":" |
| 83 |
if first { |
| 84 |
first = false |
| 85 |
out.RawString(prefix[1:]) |
| 86 |
} else { |
| 87 |
out.RawString(prefix) |
| 88 |
} |
| 89 |
out.String(string(in.Id)) |
| 90 |
} |
| 91 |
if in.Index != "" { |
| 92 |
const prefix string = ",\"_index\":" |
| 93 |
if first { |
| 94 |
first = false |
| 95 |
out.RawString(prefix[1:]) |
| 96 |
} else { |
| 97 |
out.RawString(prefix) |
| 98 |
} |
| 99 |
out.String(string(in.Index)) |
| 100 |
} |
| 101 |
if in.TTL != "" { |
| 102 |
const prefix string = ",\"_ttl\":" |
| 103 |
if first { |
| 104 |
first = false |
| 105 |
out.RawString(prefix[1:]) |
| 106 |
} else { |
| 107 |
out.RawString(prefix) |
| 108 |
} |
| 109 |
out.String(string(in.TTL)) |
| 110 |
} |
| 111 |
if in.Type != "" { |
| 112 |
const prefix string = ",\"_type\":" |
| 113 |
if first { |
| 114 |
first = false |
| 115 |
out.RawString(prefix[1:]) |
| 116 |
} else { |
| 117 |
out.RawString(prefix) |
| 118 |
} |
| 119 |
out.String(string(in.Type)) |
| 120 |
} |
| 121 |
if in.Parent != "" { |
| 122 |
const prefix string = ",\"_parent\":" |
| 123 |
if first { |
| 124 |
first = false |
| 125 |
out.RawString(prefix[1:]) |
| 126 |
} else { |
| 127 |
out.RawString(prefix) |
| 128 |
} |
| 129 |
out.String(string(in.Parent)) |
| 130 |
} |
| 131 |
if in.RetryOnConflict != nil { |
| 132 |
const prefix string = ",\"_retry_on_conflict\":" |
| 133 |
if first { |
| 134 |
first = false |
| 135 |
out.RawString(prefix[1:]) |
| 136 |
} else { |
| 137 |
out.RawString(prefix) |
| 138 |
} |
| 139 |
out.Int(int(*in.RetryOnConflict)) |
| 140 |
} |
| 141 |
if in.Routing != "" { |
| 142 |
const prefix string = ",\"_routing\":" |
| 143 |
if first { |
| 144 |
first = false |
| 145 |
out.RawString(prefix[1:]) |
| 146 |
} else { |
| 147 |
out.RawString(prefix) |
| 148 |
} |
| 149 |
out.String(string(in.Routing)) |
| 150 |
} |
| 151 |
if in.Version != 0 { |
| 152 |
const prefix string = ",\"_version\":" |
| 153 |
if first { |
| 154 |
first = false |
| 155 |
out.RawString(prefix[1:]) |
| 156 |
} else { |
| 157 |
out.RawString(prefix) |
| 158 |
} |
| 159 |
out.Int64(int64(in.Version)) |
| 160 |
} |
| 161 |
if in.VersionType != "" { |
| 162 |
const prefix string = ",\"_version_type\":" |
| 163 |
if first { |
| 164 |
first = false |
| 165 |
out.RawString(prefix[1:]) |
| 166 |
} else { |
| 167 |
out.RawString(prefix) |
| 168 |
} |
| 169 |
out.String(string(in.VersionType)) |
| 170 |
} |
| 171 |
if in.Pipeline != "" { |
| 172 |
const prefix string = ",\"pipeline\":" |
| 173 |
if first { |
| 174 |
first = false |
| 175 |
out.RawString(prefix[1:]) |
| 176 |
} else { |
| 177 |
out.RawString(prefix) |
| 178 |
} |
| 179 |
out.String(string(in.Pipeline)) |
| 180 |
} |
| 181 |
out.RawByte('}') |
| 182 |
} |
| 183 |
|
| 184 |
// MarshalJSON supports json.Marshaler interface |
| 185 |
func (v bulkIndexRequestCommandOp) MarshalJSON() ([]byte, error) { |
| 186 |
w := jwriter.Writer{} |
| 187 |
easyjson9de0fcbfEncodeGopkgInOlivereElasticV5(&w, v) |
| 188 |
return w.Buffer.BuildBytes(), w.Error |
| 189 |
} |
| 190 |
|
| 191 |
// MarshalEasyJSON supports easyjson.Marshaler interface |
| 192 |
func (v bulkIndexRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) { |
| 193 |
easyjson9de0fcbfEncodeGopkgInOlivereElasticV5(w, v) |
| 194 |
} |
| 195 |
|
| 196 |
// UnmarshalJSON supports json.Unmarshaler interface |
| 197 |
func (v *bulkIndexRequestCommandOp) UnmarshalJSON(data []byte) error { |
| 198 |
r := jlexer.Lexer{Data: data} |
| 199 |
easyjson9de0fcbfDecodeGopkgInOlivereElasticV5(&r, v) |
| 200 |
return r.Error() |
| 201 |
} |
| 202 |
|
| 203 |
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface |
| 204 |
func (v *bulkIndexRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 205 |
easyjson9de0fcbfDecodeGopkgInOlivereElasticV5(l, v) |
| 206 |
} |
| 207 |
func easyjson9de0fcbfDecodeGopkgInOlivereElasticV51(in *jlexer.Lexer, out *bulkIndexRequestCommand) { |
| 208 |
isTopLevel := in.IsStart() |
| 209 |
if in.IsNull() { |
| 210 |
in.Skip() |
| 211 |
} else { |
| 212 |
in.Delim('{') |
| 213 |
if !in.IsDelim('}') { |
| 214 |
*out = make(bulkIndexRequestCommand) |
| 215 |
} else { |
| 216 |
*out = nil |
| 217 |
} |
| 218 |
for !in.IsDelim('}') { |
| 219 |
key := string(in.String()) |
| 220 |
in.WantColon() |
| 221 |
var v1 bulkIndexRequestCommandOp |
| 222 |
(v1).UnmarshalEasyJSON(in) |
| 223 |
(*out)[key] = v1 |
| 224 |
in.WantComma() |
| 225 |
} |
| 226 |
in.Delim('}') |
| 227 |
} |
| 228 |
if isTopLevel { |
| 229 |
in.Consumed() |
| 230 |
} |
| 231 |
} |
| 232 |
func easyjson9de0fcbfEncodeGopkgInOlivereElasticV51(out *jwriter.Writer, in bulkIndexRequestCommand) { |
| 233 |
if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 { |
| 234 |
out.RawString(`null`) |
| 235 |
} else { |
| 236 |
out.RawByte('{') |
| 237 |
v2First := true |
| 238 |
for v2Name, v2Value := range in { |
| 239 |
if v2First { |
| 240 |
v2First = false |
| 241 |
} else { |
| 242 |
out.RawByte(',') |
| 243 |
} |
| 244 |
out.String(string(v2Name)) |
| 245 |
out.RawByte(':') |
| 246 |
(v2Value).MarshalEasyJSON(out) |
| 247 |
} |
| 248 |
out.RawByte('}') |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
// MarshalJSON supports json.Marshaler interface |
| 253 |
func (v bulkIndexRequestCommand) MarshalJSON() ([]byte, error) { |
| 254 |
w := jwriter.Writer{} |
| 255 |
easyjson9de0fcbfEncodeGopkgInOlivereElasticV51(&w, v) |
| 256 |
return w.Buffer.BuildBytes(), w.Error |
| 257 |
} |
| 258 |
|
| 259 |
// MarshalEasyJSON supports easyjson.Marshaler interface |
| 260 |
func (v bulkIndexRequestCommand) MarshalEasyJSON(w *jwriter.Writer) { |
| 261 |
easyjson9de0fcbfEncodeGopkgInOlivereElasticV51(w, v) |
| 262 |
} |
| 263 |
|
| 264 |
// UnmarshalJSON supports json.Unmarshaler interface |
| 265 |
func (v *bulkIndexRequestCommand) UnmarshalJSON(data []byte) error { |
| 266 |
r := jlexer.Lexer{Data: data} |
| 267 |
easyjson9de0fcbfDecodeGopkgInOlivereElasticV51(&r, v) |
| 268 |
return r.Error() |
| 269 |
} |
| 270 |
|
| 271 |
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface |
| 272 |
func (v *bulkIndexRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) { |
| 273 |
easyjson9de0fcbfDecodeGopkgInOlivereElasticV51(l, v) |
| 274 |
} |