page_info_easyjson.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package model
  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 easyjson142f204aDecodeGitBeejayKimCraftApiModel(in *jlexer.Lexer, out *PageInfo) {
  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.UnsafeFieldName(false)
  28. in.WantColon()
  29. if in.IsNull() {
  30. in.Skip()
  31. in.WantComma()
  32. continue
  33. }
  34. switch key {
  35. case "start_cursor":
  36. if in.IsNull() {
  37. in.Skip()
  38. out.StartCursor = nil
  39. } else {
  40. if out.StartCursor == nil {
  41. out.StartCursor = new(string)
  42. }
  43. *out.StartCursor = string(in.String())
  44. }
  45. case "end_cursor":
  46. if in.IsNull() {
  47. in.Skip()
  48. out.EndCursor = nil
  49. } else {
  50. if out.EndCursor == nil {
  51. out.EndCursor = new(string)
  52. }
  53. *out.EndCursor = string(in.String())
  54. }
  55. case "has_next_page":
  56. out.HasNextPage = bool(in.Bool())
  57. case "has_previous_page":
  58. out.HasPreviousPage = bool(in.Bool())
  59. default:
  60. in.SkipRecursive()
  61. }
  62. in.WantComma()
  63. }
  64. in.Delim('}')
  65. if isTopLevel {
  66. in.Consumed()
  67. }
  68. }
  69. func easyjson142f204aEncodeGitBeejayKimCraftApiModel(out *jwriter.Writer, in PageInfo) {
  70. out.RawByte('{')
  71. first := true
  72. _ = first
  73. if in.StartCursor != nil {
  74. const prefix string = ",\"start_cursor\":"
  75. first = false
  76. out.RawString(prefix[1:])
  77. out.String(string(*in.StartCursor))
  78. }
  79. if in.EndCursor != nil {
  80. const prefix string = ",\"end_cursor\":"
  81. if first {
  82. first = false
  83. out.RawString(prefix[1:])
  84. } else {
  85. out.RawString(prefix)
  86. }
  87. out.String(string(*in.EndCursor))
  88. }
  89. {
  90. const prefix string = ",\"has_next_page\":"
  91. if first {
  92. first = false
  93. out.RawString(prefix[1:])
  94. } else {
  95. out.RawString(prefix)
  96. }
  97. out.Bool(bool(in.HasNextPage))
  98. }
  99. {
  100. const prefix string = ",\"has_previous_page\":"
  101. out.RawString(prefix)
  102. out.Bool(bool(in.HasPreviousPage))
  103. }
  104. out.RawByte('}')
  105. }
  106. // MarshalJSON supports json.Marshaler interface
  107. func (v PageInfo) MarshalJSON() ([]byte, error) {
  108. w := jwriter.Writer{}
  109. easyjson142f204aEncodeGitBeejayKimCraftApiModel(&w, v)
  110. return w.Buffer.BuildBytes(), w.Error
  111. }
  112. // MarshalEasyJSON supports easyjson.Marshaler interface
  113. func (v PageInfo) MarshalEasyJSON(w *jwriter.Writer) {
  114. easyjson142f204aEncodeGitBeejayKimCraftApiModel(w, v)
  115. }
  116. // UnmarshalJSON supports json.Unmarshaler interface
  117. func (v *PageInfo) UnmarshalJSON(data []byte) error {
  118. r := jlexer.Lexer{Data: data}
  119. easyjson142f204aDecodeGitBeejayKimCraftApiModel(&r, v)
  120. return r.Error()
  121. }
  122. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  123. func (v *PageInfo) UnmarshalEasyJSON(l *jlexer.Lexer) {
  124. easyjson142f204aDecodeGitBeejayKimCraftApiModel(l, v)
  125. }