message_easyjson.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package handlers
  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 easyjson89aae3efDecodeGoStdSrc(in *jlexer.Lexer, out *Message) {
  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 "message":
  36. out.Message = string(in.String())
  37. default:
  38. in.SkipRecursive()
  39. }
  40. in.WantComma()
  41. }
  42. in.Delim('}')
  43. if isTopLevel {
  44. in.Consumed()
  45. }
  46. }
  47. func easyjson89aae3efEncodeGoStdSrc(out *jwriter.Writer, in Message) {
  48. out.RawByte('{')
  49. first := true
  50. _ = first
  51. {
  52. const prefix string = ",\"message\":"
  53. if first {
  54. first = false
  55. out.RawString(prefix[1:])
  56. } else {
  57. out.RawString(prefix)
  58. }
  59. out.String(string(in.Message))
  60. }
  61. out.RawByte('}')
  62. }
  63. // MarshalJSON supports json.Marshaler interface
  64. func (v Message) MarshalJSON() ([]byte, error) {
  65. w := jwriter.Writer{}
  66. easyjson89aae3efEncodeGoStdSrc(&w, v)
  67. return w.Buffer.BuildBytes(), w.Error
  68. }
  69. // MarshalEasyJSON supports easyjson.Marshaler interface
  70. func (v Message) MarshalEasyJSON(w *jwriter.Writer) {
  71. easyjson89aae3efEncodeGoStdSrc(w, v)
  72. }
  73. // UnmarshalJSON supports json.Unmarshaler interface
  74. func (v *Message) UnmarshalJSON(data []byte) error {
  75. r := jlexer.Lexer{Data: data}
  76. easyjson89aae3efDecodeGoStdSrc(&r, v)
  77. return r.Error()
  78. }
  79. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  80. func (v *Message) UnmarshalEasyJSON(l *jlexer.Lexer) {
  81. easyjson89aae3efDecodeGoStdSrc(l, v)
  82. }