bulk_update_request_easyjson.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package elastic
  3. import (
  4. json "encoding/json"
  5. easyjson "github.com/mailru/easyjson"
  6. jlexer "github.com/mailru/easyjson/jlexer"
  7. jwriter "github.com/mailru/easyjson/jwriter"
  8. )
  9. // suppress unused package warning
  10. var (
  11. _ *json.RawMessage
  12. _ *jlexer.Lexer
  13. _ *jwriter.Writer
  14. _ easyjson.Marshaler
  15. )
  16. func easyjson1ed00e60DecodeGopkgInOlivereElasticV5(in *jlexer.Lexer, out *bulkUpdateRequestCommandOp) {
  17. isTopLevel := in.IsStart()
  18. if in.IsNull() {
  19. if isTopLevel {
  20. in.Consumed()
  21. }
  22. in.Skip()
  23. return
  24. }
  25. in.Delim('{')
  26. for !in.IsDelim('}') {
  27. key := in.UnsafeString()
  28. in.WantColon()
  29. if in.IsNull() {
  30. in.Skip()
  31. in.WantComma()
  32. continue
  33. }
  34. switch key {
  35. case "_id":
  36. out.Id = string(in.String())
  37. case "_index":
  38. out.Index = string(in.String())
  39. case "_type":
  40. out.Type = string(in.String())
  41. case "_parent":
  42. out.Parent = string(in.String())
  43. case "_retry_on_conflict":
  44. if in.IsNull() {
  45. in.Skip()
  46. out.RetryOnConflict = nil
  47. } else {
  48. if out.RetryOnConflict == nil {
  49. out.RetryOnConflict = new(int)
  50. }
  51. *out.RetryOnConflict = int(in.Int())
  52. }
  53. case "_routing":
  54. out.Routing = string(in.String())
  55. case "_version":
  56. out.Version = int64(in.Int64())
  57. case "_version_type":
  58. out.VersionType = string(in.String())
  59. default:
  60. in.SkipRecursive()
  61. }
  62. in.WantComma()
  63. }
  64. in.Delim('}')
  65. if isTopLevel {
  66. in.Consumed()
  67. }
  68. }
  69. func easyjson1ed00e60EncodeGopkgInOlivereElasticV5(out *jwriter.Writer, in bulkUpdateRequestCommandOp) {
  70. out.RawByte('{')
  71. first := true
  72. _ = first
  73. if in.Id != "" {
  74. const prefix string = ",\"_id\":"
  75. if first {
  76. first = false
  77. out.RawString(prefix[1:])
  78. } else {
  79. out.RawString(prefix)
  80. }
  81. out.String(string(in.Id))
  82. }
  83. if in.Index != "" {
  84. const prefix string = ",\"_index\":"
  85. if first {
  86. first = false
  87. out.RawString(prefix[1:])
  88. } else {
  89. out.RawString(prefix)
  90. }
  91. out.String(string(in.Index))
  92. }
  93. if in.Type != "" {
  94. const prefix string = ",\"_type\":"
  95. if first {
  96. first = false
  97. out.RawString(prefix[1:])
  98. } else {
  99. out.RawString(prefix)
  100. }
  101. out.String(string(in.Type))
  102. }
  103. if in.Parent != "" {
  104. const prefix string = ",\"_parent\":"
  105. if first {
  106. first = false
  107. out.RawString(prefix[1:])
  108. } else {
  109. out.RawString(prefix)
  110. }
  111. out.String(string(in.Parent))
  112. }
  113. if in.RetryOnConflict != nil {
  114. const prefix string = ",\"_retry_on_conflict\":"
  115. if first {
  116. first = false
  117. out.RawString(prefix[1:])
  118. } else {
  119. out.RawString(prefix)
  120. }
  121. out.Int(int(*in.RetryOnConflict))
  122. }
  123. if in.Routing != "" {
  124. const prefix string = ",\"_routing\":"
  125. if first {
  126. first = false
  127. out.RawString(prefix[1:])
  128. } else {
  129. out.RawString(prefix)
  130. }
  131. out.String(string(in.Routing))
  132. }
  133. if in.Version != 0 {
  134. const prefix string = ",\"_version\":"
  135. if first {
  136. first = false
  137. out.RawString(prefix[1:])
  138. } else {
  139. out.RawString(prefix)
  140. }
  141. out.Int64(int64(in.Version))
  142. }
  143. if in.VersionType != "" {
  144. const prefix string = ",\"_version_type\":"
  145. if first {
  146. first = false
  147. out.RawString(prefix[1:])
  148. } else {
  149. out.RawString(prefix)
  150. }
  151. out.String(string(in.VersionType))
  152. }
  153. out.RawByte('}')
  154. }
  155. // MarshalJSON supports json.Marshaler interface
  156. func (v bulkUpdateRequestCommandOp) MarshalJSON() ([]byte, error) {
  157. w := jwriter.Writer{}
  158. easyjson1ed00e60EncodeGopkgInOlivereElasticV5(&w, v)
  159. return w.Buffer.BuildBytes(), w.Error
  160. }
  161. // MarshalEasyJSON supports easyjson.Marshaler interface
  162. func (v bulkUpdateRequestCommandOp) MarshalEasyJSON(w *jwriter.Writer) {
  163. easyjson1ed00e60EncodeGopkgInOlivereElasticV5(w, v)
  164. }
  165. // UnmarshalJSON supports json.Unmarshaler interface
  166. func (v *bulkUpdateRequestCommandOp) UnmarshalJSON(data []byte) error {
  167. r := jlexer.Lexer{Data: data}
  168. easyjson1ed00e60DecodeGopkgInOlivereElasticV5(&r, v)
  169. return r.Error()
  170. }
  171. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  172. func (v *bulkUpdateRequestCommandOp) UnmarshalEasyJSON(l *jlexer.Lexer) {
  173. easyjson1ed00e60DecodeGopkgInOlivereElasticV5(l, v)
  174. }
  175. func easyjson1ed00e60DecodeGopkgInOlivereElasticV51(in *jlexer.Lexer, out *bulkUpdateRequestCommandData) {
  176. isTopLevel := in.IsStart()
  177. if in.IsNull() {
  178. if isTopLevel {
  179. in.Consumed()
  180. }
  181. in.Skip()
  182. return
  183. }
  184. in.Delim('{')
  185. for !in.IsDelim('}') {
  186. key := in.UnsafeString()
  187. in.WantColon()
  188. if in.IsNull() {
  189. in.Skip()
  190. in.WantComma()
  191. continue
  192. }
  193. switch key {
  194. case "detect_noop":
  195. if in.IsNull() {
  196. in.Skip()
  197. out.DetectNoop = nil
  198. } else {
  199. if out.DetectNoop == nil {
  200. out.DetectNoop = new(bool)
  201. }
  202. *out.DetectNoop = bool(in.Bool())
  203. }
  204. case "doc":
  205. if m, ok := out.Doc.(easyjson.Unmarshaler); ok {
  206. m.UnmarshalEasyJSON(in)
  207. } else if m, ok := out.Doc.(json.Unmarshaler); ok {
  208. _ = m.UnmarshalJSON(in.Raw())
  209. } else {
  210. out.Doc = in.Interface()
  211. }
  212. case "doc_as_upsert":
  213. if in.IsNull() {
  214. in.Skip()
  215. out.DocAsUpsert = nil
  216. } else {
  217. if out.DocAsUpsert == nil {
  218. out.DocAsUpsert = new(bool)
  219. }
  220. *out.DocAsUpsert = bool(in.Bool())
  221. }
  222. case "upsert":
  223. if m, ok := out.Upsert.(easyjson.Unmarshaler); ok {
  224. m.UnmarshalEasyJSON(in)
  225. } else if m, ok := out.Upsert.(json.Unmarshaler); ok {
  226. _ = m.UnmarshalJSON(in.Raw())
  227. } else {
  228. out.Upsert = in.Interface()
  229. }
  230. case "script":
  231. if m, ok := out.Script.(easyjson.Unmarshaler); ok {
  232. m.UnmarshalEasyJSON(in)
  233. } else if m, ok := out.Script.(json.Unmarshaler); ok {
  234. _ = m.UnmarshalJSON(in.Raw())
  235. } else {
  236. out.Script = in.Interface()
  237. }
  238. case "scripted_upsert":
  239. if in.IsNull() {
  240. in.Skip()
  241. out.ScriptedUpsert = nil
  242. } else {
  243. if out.ScriptedUpsert == nil {
  244. out.ScriptedUpsert = new(bool)
  245. }
  246. *out.ScriptedUpsert = bool(in.Bool())
  247. }
  248. case "_source":
  249. if in.IsNull() {
  250. in.Skip()
  251. out.Source = nil
  252. } else {
  253. if out.Source == nil {
  254. out.Source = new(bool)
  255. }
  256. *out.Source = bool(in.Bool())
  257. }
  258. default:
  259. in.SkipRecursive()
  260. }
  261. in.WantComma()
  262. }
  263. in.Delim('}')
  264. if isTopLevel {
  265. in.Consumed()
  266. }
  267. }
  268. func easyjson1ed00e60EncodeGopkgInOlivereElasticV51(out *jwriter.Writer, in bulkUpdateRequestCommandData) {
  269. out.RawByte('{')
  270. first := true
  271. _ = first
  272. if in.DetectNoop != nil {
  273. const prefix string = ",\"detect_noop\":"
  274. if first {
  275. first = false
  276. out.RawString(prefix[1:])
  277. } else {
  278. out.RawString(prefix)
  279. }
  280. out.Bool(bool(*in.DetectNoop))
  281. }
  282. if in.Doc != nil {
  283. const prefix string = ",\"doc\":"
  284. if first {
  285. first = false
  286. out.RawString(prefix[1:])
  287. } else {
  288. out.RawString(prefix)
  289. }
  290. if m, ok := in.Doc.(easyjson.Marshaler); ok {
  291. m.MarshalEasyJSON(out)
  292. } else if m, ok := in.Doc.(json.Marshaler); ok {
  293. out.Raw(m.MarshalJSON())
  294. } else {
  295. out.Raw(json.Marshal(in.Doc))
  296. }
  297. }
  298. if in.DocAsUpsert != nil {
  299. const prefix string = ",\"doc_as_upsert\":"
  300. if first {
  301. first = false
  302. out.RawString(prefix[1:])
  303. } else {
  304. out.RawString(prefix)
  305. }
  306. out.Bool(bool(*in.DocAsUpsert))
  307. }
  308. if in.Upsert != nil {
  309. const prefix string = ",\"upsert\":"
  310. if first {
  311. first = false
  312. out.RawString(prefix[1:])
  313. } else {
  314. out.RawString(prefix)
  315. }
  316. if m, ok := in.Upsert.(easyjson.Marshaler); ok {
  317. m.MarshalEasyJSON(out)
  318. } else if m, ok := in.Upsert.(json.Marshaler); ok {
  319. out.Raw(m.MarshalJSON())
  320. } else {
  321. out.Raw(json.Marshal(in.Upsert))
  322. }
  323. }
  324. if in.Script != nil {
  325. const prefix string = ",\"script\":"
  326. if first {
  327. first = false
  328. out.RawString(prefix[1:])
  329. } else {
  330. out.RawString(prefix)
  331. }
  332. if m, ok := in.Script.(easyjson.Marshaler); ok {
  333. m.MarshalEasyJSON(out)
  334. } else if m, ok := in.Script.(json.Marshaler); ok {
  335. out.Raw(m.MarshalJSON())
  336. } else {
  337. out.Raw(json.Marshal(in.Script))
  338. }
  339. }
  340. if in.ScriptedUpsert != nil {
  341. const prefix string = ",\"scripted_upsert\":"
  342. if first {
  343. first = false
  344. out.RawString(prefix[1:])
  345. } else {
  346. out.RawString(prefix)
  347. }
  348. out.Bool(bool(*in.ScriptedUpsert))
  349. }
  350. if in.Source != nil {
  351. const prefix string = ",\"_source\":"
  352. if first {
  353. first = false
  354. out.RawString(prefix[1:])
  355. } else {
  356. out.RawString(prefix)
  357. }
  358. out.Bool(bool(*in.Source))
  359. }
  360. out.RawByte('}')
  361. }
  362. // MarshalJSON supports json.Marshaler interface
  363. func (v bulkUpdateRequestCommandData) MarshalJSON() ([]byte, error) {
  364. w := jwriter.Writer{}
  365. easyjson1ed00e60EncodeGopkgInOlivereElasticV51(&w, v)
  366. return w.Buffer.BuildBytes(), w.Error
  367. }
  368. // MarshalEasyJSON supports easyjson.Marshaler interface
  369. func (v bulkUpdateRequestCommandData) MarshalEasyJSON(w *jwriter.Writer) {
  370. easyjson1ed00e60EncodeGopkgInOlivereElasticV51(w, v)
  371. }
  372. // UnmarshalJSON supports json.Unmarshaler interface
  373. func (v *bulkUpdateRequestCommandData) UnmarshalJSON(data []byte) error {
  374. r := jlexer.Lexer{Data: data}
  375. easyjson1ed00e60DecodeGopkgInOlivereElasticV51(&r, v)
  376. return r.Error()
  377. }
  378. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  379. func (v *bulkUpdateRequestCommandData) UnmarshalEasyJSON(l *jlexer.Lexer) {
  380. easyjson1ed00e60DecodeGopkgInOlivereElasticV51(l, v)
  381. }
  382. func easyjson1ed00e60DecodeGopkgInOlivereElasticV52(in *jlexer.Lexer, out *bulkUpdateRequestCommand) {
  383. isTopLevel := in.IsStart()
  384. if in.IsNull() {
  385. in.Skip()
  386. } else {
  387. in.Delim('{')
  388. if !in.IsDelim('}') {
  389. *out = make(bulkUpdateRequestCommand)
  390. } else {
  391. *out = nil
  392. }
  393. for !in.IsDelim('}') {
  394. key := string(in.String())
  395. in.WantColon()
  396. var v1 bulkUpdateRequestCommandOp
  397. (v1).UnmarshalEasyJSON(in)
  398. (*out)[key] = v1
  399. in.WantComma()
  400. }
  401. in.Delim('}')
  402. }
  403. if isTopLevel {
  404. in.Consumed()
  405. }
  406. }
  407. func easyjson1ed00e60EncodeGopkgInOlivereElasticV52(out *jwriter.Writer, in bulkUpdateRequestCommand) {
  408. if in == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
  409. out.RawString(`null`)
  410. } else {
  411. out.RawByte('{')
  412. v2First := true
  413. for v2Name, v2Value := range in {
  414. if v2First {
  415. v2First = false
  416. } else {
  417. out.RawByte(',')
  418. }
  419. out.String(string(v2Name))
  420. out.RawByte(':')
  421. (v2Value).MarshalEasyJSON(out)
  422. }
  423. out.RawByte('}')
  424. }
  425. }
  426. // MarshalJSON supports json.Marshaler interface
  427. func (v bulkUpdateRequestCommand) MarshalJSON() ([]byte, error) {
  428. w := jwriter.Writer{}
  429. easyjson1ed00e60EncodeGopkgInOlivereElasticV52(&w, v)
  430. return w.Buffer.BuildBytes(), w.Error
  431. }
  432. // MarshalEasyJSON supports easyjson.Marshaler interface
  433. func (v bulkUpdateRequestCommand) MarshalEasyJSON(w *jwriter.Writer) {
  434. easyjson1ed00e60EncodeGopkgInOlivereElasticV52(w, v)
  435. }
  436. // UnmarshalJSON supports json.Unmarshaler interface
  437. func (v *bulkUpdateRequestCommand) UnmarshalJSON(data []byte) error {
  438. r := jlexer.Lexer{Data: data}
  439. easyjson1ed00e60DecodeGopkgInOlivereElasticV52(&r, v)
  440. return r.Error()
  441. }
  442. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  443. func (v *bulkUpdateRequestCommand) UnmarshalEasyJSON(l *jlexer.Lexer) {
  444. easyjson1ed00e60DecodeGopkgInOlivereElasticV52(l, v)
  445. }