bulk_index_request_easyjson.go 6.2 KB

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