result_easyjson.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package webmail
  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 easyjsonD3b49167DecodeGitlabIzeneComGonglaoWebmail(in *jlexer.Lexer, out *ResultList) {
  17. isTopLevel := in.IsStart()
  18. if in.IsNull() {
  19. in.Skip()
  20. *out = nil
  21. } else {
  22. in.Delim('[')
  23. if *out == nil {
  24. if !in.IsDelim(']') {
  25. *out = make(ResultList, 0, 4)
  26. } else {
  27. *out = ResultList{}
  28. }
  29. } else {
  30. *out = (*out)[:0]
  31. }
  32. for !in.IsDelim(']') {
  33. var v1 string
  34. v1 = string(in.String())
  35. *out = append(*out, v1)
  36. in.WantComma()
  37. }
  38. in.Delim(']')
  39. }
  40. if isTopLevel {
  41. in.Consumed()
  42. }
  43. }
  44. func easyjsonD3b49167EncodeGitlabIzeneComGonglaoWebmail(out *jwriter.Writer, in ResultList) {
  45. if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
  46. out.RawString("null")
  47. } else {
  48. out.RawByte('[')
  49. for v2, v3 := range in {
  50. if v2 > 0 {
  51. out.RawByte(',')
  52. }
  53. out.String(string(v3))
  54. }
  55. out.RawByte(']')
  56. }
  57. }
  58. // MarshalJSON supports json.Marshaler interface
  59. func (v ResultList) MarshalJSON() ([]byte, error) {
  60. w := jwriter.Writer{}
  61. easyjsonD3b49167EncodeGitlabIzeneComGonglaoWebmail(&w, v)
  62. return w.Buffer.BuildBytes(), w.Error
  63. }
  64. // MarshalEasyJSON supports easyjson.Marshaler interface
  65. func (v ResultList) MarshalEasyJSON(w *jwriter.Writer) {
  66. easyjsonD3b49167EncodeGitlabIzeneComGonglaoWebmail(w, v)
  67. }
  68. // UnmarshalJSON supports json.Unmarshaler interface
  69. func (v *ResultList) UnmarshalJSON(data []byte) error {
  70. r := jlexer.Lexer{Data: data}
  71. easyjsonD3b49167DecodeGitlabIzeneComGonglaoWebmail(&r, v)
  72. return r.Error()
  73. }
  74. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  75. func (v *ResultList) UnmarshalEasyJSON(l *jlexer.Lexer) {
  76. easyjsonD3b49167DecodeGitlabIzeneComGonglaoWebmail(l, v)
  77. }
  78. func easyjsonD3b49167DecodeGitlabIzeneComGonglaoWebmail1(in *jlexer.Lexer, out *Result) {
  79. isTopLevel := in.IsStart()
  80. if in.IsNull() {
  81. if isTopLevel {
  82. in.Consumed()
  83. }
  84. in.Skip()
  85. return
  86. }
  87. in.Delim('{')
  88. for !in.IsDelim('}') {
  89. key := in.UnsafeFieldName(false)
  90. in.WantColon()
  91. if in.IsNull() {
  92. in.Skip()
  93. in.WantComma()
  94. continue
  95. }
  96. switch key {
  97. case "result":
  98. out.Ok = string(in.String())
  99. case "errno":
  100. out.Error = in.JsonNumber()
  101. default:
  102. in.SkipRecursive()
  103. }
  104. in.WantComma()
  105. }
  106. in.Delim('}')
  107. if isTopLevel {
  108. in.Consumed()
  109. }
  110. }
  111. func easyjsonD3b49167EncodeGitlabIzeneComGonglaoWebmail1(out *jwriter.Writer, in Result) {
  112. out.RawByte('{')
  113. first := true
  114. _ = first
  115. {
  116. const prefix string = ",\"result\":"
  117. out.RawString(prefix[1:])
  118. out.String(string(in.Ok))
  119. }
  120. {
  121. const prefix string = ",\"errno\":"
  122. out.RawString(prefix)
  123. out.String(string(in.Error))
  124. }
  125. out.RawByte('}')
  126. }
  127. // MarshalJSON supports json.Marshaler interface
  128. func (v Result) MarshalJSON() ([]byte, error) {
  129. w := jwriter.Writer{}
  130. easyjsonD3b49167EncodeGitlabIzeneComGonglaoWebmail1(&w, v)
  131. return w.Buffer.BuildBytes(), w.Error
  132. }
  133. // MarshalEasyJSON supports easyjson.Marshaler interface
  134. func (v Result) MarshalEasyJSON(w *jwriter.Writer) {
  135. easyjsonD3b49167EncodeGitlabIzeneComGonglaoWebmail1(w, v)
  136. }
  137. // UnmarshalJSON supports json.Unmarshaler interface
  138. func (v *Result) UnmarshalJSON(data []byte) error {
  139. r := jlexer.Lexer{Data: data}
  140. easyjsonD3b49167DecodeGitlabIzeneComGonglaoWebmail1(&r, v)
  141. return r.Error()
  142. }
  143. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  144. func (v *Result) UnmarshalEasyJSON(l *jlexer.Lexer) {
  145. easyjsonD3b49167DecodeGitlabIzeneComGonglaoWebmail1(l, v)
  146. }