Files
ozu.io/web/response_easyjson.go

109 lines
2.3 KiB
Go

// AUTOGENERATED FILE: easyjson marshaller/unmarshallers.
package web
import (
json "encoding/json"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ = json.RawMessage{}
_ = jlexer.Lexer{}
_ = jwriter.Writer{}
)
func easyjson6ff3ac1dDecodeGithubComJimehOzuIoWeb(in *jlexer.Lexer, out *Response) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "uid":
out.UID = string(in.String())
case "url":
out.URL = string(in.String())
case "target":
out.Target = string(in.String())
case "error":
out.Error = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjson6ff3ac1dEncodeGithubComJimehOzuIoWeb(out *jwriter.Writer, in Response) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"uid\":")
out.String(string(in.UID))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"url\":")
out.String(string(in.URL))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"target\":")
out.String(string(in.Target))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"error\":")
out.String(string(in.Error))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Response) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson6ff3ac1dEncodeGithubComJimehOzuIoWeb(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Response) MarshalEasyJSON(w *jwriter.Writer) {
easyjson6ff3ac1dEncodeGithubComJimehOzuIoWeb(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Response) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson6ff3ac1dDecodeGithubComJimehOzuIoWeb(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson6ff3ac1dDecodeGithubComJimehOzuIoWeb(l, v)
}