// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. package imhashdb import ( json "encoding/json" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" ) // suppress unused package warning var ( _ *json.RawMessage _ *jlexer.Lexer _ *jwriter.Writer _ easyjson.Marshaler ) func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb(in *jlexer.Lexer, out *QueryResp) { 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 "err": out.Err = string(in.String()) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb(out *jwriter.Writer, in QueryResp) { out.RawByte('{') first := true _ = first if in.Err != "" { const prefix string = ",\"err\":" first = false out.RawString(prefix[1:]) out.String(string(in.Err)) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v QueryResp) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v QueryResp) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *QueryResp) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *QueryResp) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb1(in *jlexer.Lexer, out *QueryReq) { 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 "type": out.HashType = HashType(in.String()) case "hash": if in.IsNull() { in.Skip() out.Hash = nil } else { out.Hash = in.Bytes() } case "distance": out.Distance = uint(in.Uint()) case "limit": out.Limit = uint(in.Uint()) case "offset": out.Offset = uint(in.Uint()) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb1(out *jwriter.Writer, in QueryReq) { out.RawByte('{') first := true _ = first { const prefix string = ",\"type\":" out.RawString(prefix[1:]) out.String(string(in.HashType)) } { const prefix string = ",\"hash\":" out.RawString(prefix) out.Base64Bytes(in.Hash) } { const prefix string = ",\"distance\":" out.RawString(prefix) out.Uint(uint(in.Distance)) } { const prefix string = ",\"limit\":" out.RawString(prefix) out.Uint(uint(in.Limit)) } { const prefix string = ",\"offset\":" out.RawString(prefix) out.Uint(uint(in.Offset)) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v QueryReq) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb1(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v QueryReq) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb1(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *QueryReq) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb1(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *QueryReq) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb1(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb2(in *jlexer.Lexer, out *Meta) { 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 "retrieved_at": out.RetrievedAt = int64(in.Int64()) case "id": out.Id = string(in.String()) case "meta": if in.IsNull() { in.Skip() out.Meta = nil } else { out.Meta = in.Bytes() } default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb2(out *jwriter.Writer, in Meta) { out.RawByte('{') first := true _ = first { const prefix string = ",\"retrieved_at\":" out.RawString(prefix[1:]) out.Int64(int64(in.RetrievedAt)) } { const prefix string = ",\"id\":" out.RawString(prefix) out.String(string(in.Id)) } { const prefix string = ",\"meta\":" out.RawString(prefix) out.Base64Bytes(in.Meta) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v Meta) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb2(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Meta) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb2(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Meta) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb2(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Meta) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb2(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb3(in *jlexer.Lexer, out *ImageList) { 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 "images": if in.IsNull() { in.Skip() out.Images = nil } else { in.Delim('[') if out.Images == nil { if !in.IsDelim(']') { out.Images = make([]*Image, 0, 8) } else { out.Images = []*Image{} } } else { out.Images = (out.Images)[:0] } for !in.IsDelim(']') { var v7 *Image if in.IsNull() { in.Skip() v7 = nil } else { if v7 == nil { v7 = new(Image) } (*v7).UnmarshalEasyJSON(in) } out.Images = append(out.Images, v7) in.WantComma() } in.Delim(']') } default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb3(out *jwriter.Writer, in ImageList) { out.RawByte('{') first := true _ = first { const prefix string = ",\"images\":" out.RawString(prefix[1:]) if in.Images == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') for v8, v9 := range in.Images { if v8 > 0 { out.RawByte(',') } if v9 == nil { out.RawString("null") } else { (*v9).MarshalEasyJSON(out) } } out.RawByte(']') } } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v ImageList) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb3(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ImageList) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb3(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ImageList) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb3(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *ImageList) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb3(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb4(in *jlexer.Lexer, out *ImageHasMeta) { 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 "url": out.Url = string(in.String()) case "meta": (out.Meta).UnmarshalEasyJSON(in) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb4(out *jwriter.Writer, in ImageHasMeta) { out.RawByte('{') first := true _ = first { const prefix string = ",\"url\":" out.RawString(prefix[1:]) out.String(string(in.Url)) } { const prefix string = ",\"meta\":" out.RawString(prefix) (in.Meta).MarshalEasyJSON(out) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v ImageHasMeta) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb4(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ImageHasMeta) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb4(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ImageHasMeta) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb4(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *ImageHasMeta) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb4(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb5(in *jlexer.Lexer, out *Image) { 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 "size": out.Size = int(in.Int()) case "sha1": if in.IsNull() { in.Skip() out.Sha1 = nil } else { out.Sha1 = in.Bytes() } case "md5": if in.IsNull() { in.Skip() out.Md5 = nil } else { out.Md5 = in.Bytes() } case "sha256": if in.IsNull() { in.Skip() out.Sha256 = nil } else { out.Sha256 = in.Bytes() } case "crc32": out.Crc32 = uint32(in.Uint32()) case "meta": if in.IsNull() { in.Skip() out.Meta = nil } else { in.Delim('[') if out.Meta == nil { if !in.IsDelim(']') { out.Meta = make([]ImageHasMeta, 0, 1) } else { out.Meta = []ImageHasMeta{} } } else { out.Meta = (out.Meta)[:0] } for !in.IsDelim(']') { var v13 ImageHasMeta (v13).UnmarshalEasyJSON(in) out.Meta = append(out.Meta, v13) in.WantComma() } in.Delim(']') } default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb5(out *jwriter.Writer, in Image) { out.RawByte('{') first := true _ = first { const prefix string = ",\"size\":" out.RawString(prefix[1:]) out.Int(int(in.Size)) } { const prefix string = ",\"sha1\":" out.RawString(prefix) out.Base64Bytes(in.Sha1) } { const prefix string = ",\"md5\":" out.RawString(prefix) out.Base64Bytes(in.Md5) } { const prefix string = ",\"sha256\":" out.RawString(prefix) out.Base64Bytes(in.Sha256) } { const prefix string = ",\"crc32\":" out.RawString(prefix) out.Uint32(uint32(in.Crc32)) } { const prefix string = ",\"meta\":" out.RawString(prefix) if in.Meta == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { out.RawString("null") } else { out.RawByte('[') for v20, v21 := range in.Meta { if v20 > 0 { out.RawByte(',') } (v21).MarshalEasyJSON(out) } out.RawByte(']') } } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v Image) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb5(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v Image) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb5(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *Image) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb5(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *Image) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb5(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb6(in *jlexer.Lexer, out *HashResp) { 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 "ahash:12": if in.IsNull() { in.Skip() out.AHash = nil } else { out.AHash = in.Bytes() } case "dhash:12": if in.IsNull() { in.Skip() out.DHash = nil } else { out.DHash = in.Bytes() } case "mhash:12": if in.IsNull() { in.Skip() out.MHash = nil } else { out.MHash = in.Bytes() } case "phash:12:4": if in.IsNull() { in.Skip() out.PHash = nil } else { out.PHash = in.Bytes() } case "whash:18:haar": if in.IsNull() { in.Skip() out.WHash = nil } else { out.WHash = in.Bytes() } default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb6(out *jwriter.Writer, in HashResp) { out.RawByte('{') first := true _ = first { const prefix string = ",\"ahash:12\":" out.RawString(prefix[1:]) out.Base64Bytes(in.AHash) } { const prefix string = ",\"dhash:12\":" out.RawString(prefix) out.Base64Bytes(in.DHash) } { const prefix string = ",\"mhash:12\":" out.RawString(prefix) out.Base64Bytes(in.MHash) } { const prefix string = ",\"phash:12:4\":" out.RawString(prefix) out.Base64Bytes(in.PHash) } { const prefix string = ",\"whash:18:haar\":" out.RawString(prefix) out.Base64Bytes(in.WHash) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v HashResp) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb6(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v HashResp) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb6(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *HashResp) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb6(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *HashResp) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb6(l, v) } func easyjsonD2b7633eDecodeGithubComSimon987Imhashdb7(in *jlexer.Lexer, out *HashReq) { 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 "data": if in.IsNull() { in.Skip() out.Data = nil } else { out.Data = in.Bytes() } default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjsonD2b7633eEncodeGithubComSimon987Imhashdb7(out *jwriter.Writer, in HashReq) { out.RawByte('{') first := true _ = first { const prefix string = ",\"data\":" out.RawString(prefix[1:]) out.Base64Bytes(in.Data) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v HashReq) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjsonD2b7633eEncodeGithubComSimon987Imhashdb7(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v HashReq) MarshalEasyJSON(w *jwriter.Writer) { easyjsonD2b7633eEncodeGithubComSimon987Imhashdb7(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *HashReq) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjsonD2b7633eDecodeGithubComSimon987Imhashdb7(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *HashReq) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjsonD2b7633eDecodeGithubComSimon987Imhashdb7(l, v) }