2
0

bridge_message_easyjson.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
  2. package afreeca
  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 easyjsonAc9440cbDecodeGitBeejayKimWatchDogWardPlatformAfreeca(in *jlexer.Lexer, out *BridgeMessage) {
  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 "SVC":
  36. out.Command = BridgeCommand(in.String())
  37. case "RESULT":
  38. out.Result = int(in.Int())
  39. case "DATA":
  40. if in.IsNull() {
  41. in.Skip()
  42. } else {
  43. in.Delim('{')
  44. out.Data = make(map[string]interface{})
  45. for !in.IsDelim('}') {
  46. key := string(in.String())
  47. in.WantColon()
  48. var v1 interface{}
  49. if m, ok := v1.(easyjson.Unmarshaler); ok {
  50. m.UnmarshalEasyJSON(in)
  51. } else if m, ok := v1.(json.Unmarshaler); ok {
  52. _ = m.UnmarshalJSON(in.Raw())
  53. } else {
  54. v1 = in.Interface()
  55. }
  56. (out.Data)[key] = v1
  57. in.WantComma()
  58. }
  59. in.Delim('}')
  60. }
  61. default:
  62. in.SkipRecursive()
  63. }
  64. in.WantComma()
  65. }
  66. in.Delim('}')
  67. if isTopLevel {
  68. in.Consumed()
  69. }
  70. }
  71. func easyjsonAc9440cbEncodeGitBeejayKimWatchDogWardPlatformAfreeca(out *jwriter.Writer, in BridgeMessage) {
  72. out.RawByte('{')
  73. first := true
  74. _ = first
  75. {
  76. const prefix string = ",\"SVC\":"
  77. out.RawString(prefix[1:])
  78. out.String(string(in.Command))
  79. }
  80. {
  81. const prefix string = ",\"RESULT\":"
  82. out.RawString(prefix)
  83. out.Int(int(in.Result))
  84. }
  85. {
  86. const prefix string = ",\"DATA\":"
  87. out.RawString(prefix)
  88. if in.Data == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
  89. out.RawString(`null`)
  90. } else {
  91. out.RawByte('{')
  92. v2First := true
  93. for v2Name, v2Value := range in.Data {
  94. if v2First {
  95. v2First = false
  96. } else {
  97. out.RawByte(',')
  98. }
  99. out.String(string(v2Name))
  100. out.RawByte(':')
  101. if m, ok := v2Value.(easyjson.Marshaler); ok {
  102. m.MarshalEasyJSON(out)
  103. } else if m, ok := v2Value.(json.Marshaler); ok {
  104. out.Raw(m.MarshalJSON())
  105. } else {
  106. out.Raw(json.Marshal(v2Value))
  107. }
  108. }
  109. out.RawByte('}')
  110. }
  111. }
  112. out.RawByte('}')
  113. }
  114. // MarshalJSON supports json.Marshaler interface
  115. func (v BridgeMessage) MarshalJSON() ([]byte, error) {
  116. w := jwriter.Writer{}
  117. easyjsonAc9440cbEncodeGitBeejayKimWatchDogWardPlatformAfreeca(&w, v)
  118. return w.Buffer.BuildBytes(), w.Error
  119. }
  120. // MarshalEasyJSON supports easyjson.Marshaler interface
  121. func (v BridgeMessage) MarshalEasyJSON(w *jwriter.Writer) {
  122. easyjsonAc9440cbEncodeGitBeejayKimWatchDogWardPlatformAfreeca(w, v)
  123. }
  124. // UnmarshalJSON supports json.Unmarshaler interface
  125. func (v *BridgeMessage) UnmarshalJSON(data []byte) error {
  126. r := jlexer.Lexer{Data: data}
  127. easyjsonAc9440cbDecodeGitBeejayKimWatchDogWardPlatformAfreeca(&r, v)
  128. return r.Error()
  129. }
  130. // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
  131. func (v *BridgeMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {
  132. easyjsonAc9440cbDecodeGitBeejayKimWatchDogWardPlatformAfreeca(l, v)
  133. }