556 lines
12 KiB
Go
556 lines
12 KiB
Go
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
|
|
|
|
package mapbox
|
|
|
|
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 easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox(in *jlexer.Lexer, out *Properties) {
|
|
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 "accuracy":
|
|
out.Accuracy = string(in.String())
|
|
case "short_code":
|
|
out.ShortCode = string(in.String())
|
|
default:
|
|
in.SkipRecursive()
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
func easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox(out *jwriter.Writer, in Properties) {
|
|
out.RawByte('{')
|
|
first := true
|
|
_ = first
|
|
{
|
|
const prefix string = ",\"accuracy\":"
|
|
out.RawString(prefix[1:])
|
|
out.String(string(in.Accuracy))
|
|
}
|
|
{
|
|
const prefix string = ",\"short_code\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.ShortCode))
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// MarshalJSON supports json.Marshaler interface
|
|
func (v Properties) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox(&w, v)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
|
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
func (v Properties) MarshalEasyJSON(w *jwriter.Writer) {
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox(w, v)
|
|
}
|
|
|
|
// UnmarshalJSON supports json.Unmarshaler interface
|
|
func (v *Properties) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox(&r, v)
|
|
return r.Error()
|
|
}
|
|
|
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
func (v *Properties) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox(l, v)
|
|
}
|
|
func easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox1(in *jlexer.Lexer, out *Geometry) {
|
|
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.Type = string(in.String())
|
|
case "coordinates":
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
out.Coordinates = nil
|
|
} else {
|
|
in.Delim('[')
|
|
if out.Coordinates == nil {
|
|
if !in.IsDelim(']') {
|
|
out.Coordinates = make([]float64, 0, 8)
|
|
} else {
|
|
out.Coordinates = []float64{}
|
|
}
|
|
} else {
|
|
out.Coordinates = (out.Coordinates)[:0]
|
|
}
|
|
for !in.IsDelim(']') {
|
|
var v1 float64
|
|
v1 = float64(in.Float64())
|
|
out.Coordinates = append(out.Coordinates, v1)
|
|
in.WantComma()
|
|
}
|
|
in.Delim(']')
|
|
}
|
|
default:
|
|
in.SkipRecursive()
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
func easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox1(out *jwriter.Writer, in Geometry) {
|
|
out.RawByte('{')
|
|
first := true
|
|
_ = first
|
|
{
|
|
const prefix string = ",\"type\":"
|
|
out.RawString(prefix[1:])
|
|
out.String(string(in.Type))
|
|
}
|
|
{
|
|
const prefix string = ",\"coordinates\":"
|
|
out.RawString(prefix)
|
|
if in.Coordinates == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
out.RawString("null")
|
|
} else {
|
|
out.RawByte('[')
|
|
for v2, v3 := range in.Coordinates {
|
|
if v2 > 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.Float64(float64(v3))
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// MarshalJSON supports json.Marshaler interface
|
|
func (v Geometry) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox1(&w, v)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
|
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
func (v Geometry) MarshalEasyJSON(w *jwriter.Writer) {
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox1(w, v)
|
|
}
|
|
|
|
// UnmarshalJSON supports json.Unmarshaler interface
|
|
func (v *Geometry) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox1(&r, v)
|
|
return r.Error()
|
|
}
|
|
|
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
func (v *Geometry) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox1(l, v)
|
|
}
|
|
func easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox2(in *jlexer.Lexer, out *Feature) {
|
|
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 "id":
|
|
out.ID = string(in.String())
|
|
case "type":
|
|
out.Type = string(in.String())
|
|
case "place_type":
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
out.PlaceType = nil
|
|
} else {
|
|
in.Delim('[')
|
|
if out.PlaceType == nil {
|
|
if !in.IsDelim(']') {
|
|
out.PlaceType = make([]string, 0, 4)
|
|
} else {
|
|
out.PlaceType = []string{}
|
|
}
|
|
} else {
|
|
out.PlaceType = (out.PlaceType)[:0]
|
|
}
|
|
for !in.IsDelim(']') {
|
|
var v4 string
|
|
v4 = string(in.String())
|
|
out.PlaceType = append(out.PlaceType, v4)
|
|
in.WantComma()
|
|
}
|
|
in.Delim(']')
|
|
}
|
|
case "relevance":
|
|
out.Relevance = float64(in.Float64())
|
|
case "properties":
|
|
(out.Properties).UnmarshalEasyJSON(in)
|
|
case "text":
|
|
out.Text = string(in.String())
|
|
case "place_name":
|
|
out.PlaceName = string(in.String())
|
|
case "center":
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
out.Center = nil
|
|
} else {
|
|
in.Delim('[')
|
|
if out.Center == nil {
|
|
if !in.IsDelim(']') {
|
|
out.Center = make([]float64, 0, 8)
|
|
} else {
|
|
out.Center = []float64{}
|
|
}
|
|
} else {
|
|
out.Center = (out.Center)[:0]
|
|
}
|
|
for !in.IsDelim(']') {
|
|
var v5 float64
|
|
v5 = float64(in.Float64())
|
|
out.Center = append(out.Center, v5)
|
|
in.WantComma()
|
|
}
|
|
in.Delim(']')
|
|
}
|
|
case "geometry":
|
|
(out.Geometry).UnmarshalEasyJSON(in)
|
|
case "address":
|
|
out.Address = string(in.String())
|
|
case "context":
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
out.Context = nil
|
|
} else {
|
|
in.Delim('[')
|
|
if out.Context == nil {
|
|
if !in.IsDelim(']') {
|
|
out.Context = make([]Context, 0, 1)
|
|
} else {
|
|
out.Context = []Context{}
|
|
}
|
|
} else {
|
|
out.Context = (out.Context)[:0]
|
|
}
|
|
for !in.IsDelim(']') {
|
|
var v6 Context
|
|
(v6).UnmarshalEasyJSON(in)
|
|
out.Context = append(out.Context, v6)
|
|
in.WantComma()
|
|
}
|
|
in.Delim(']')
|
|
}
|
|
case "bbox":
|
|
if in.IsNull() {
|
|
in.Skip()
|
|
out.BoundingBox = nil
|
|
} else {
|
|
in.Delim('[')
|
|
if out.BoundingBox == nil {
|
|
if !in.IsDelim(']') {
|
|
out.BoundingBox = make([]float64, 0, 8)
|
|
} else {
|
|
out.BoundingBox = []float64{}
|
|
}
|
|
} else {
|
|
out.BoundingBox = (out.BoundingBox)[:0]
|
|
}
|
|
for !in.IsDelim(']') {
|
|
var v7 float64
|
|
v7 = float64(in.Float64())
|
|
out.BoundingBox = append(out.BoundingBox, v7)
|
|
in.WantComma()
|
|
}
|
|
in.Delim(']')
|
|
}
|
|
default:
|
|
in.SkipRecursive()
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
func easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox2(out *jwriter.Writer, in Feature) {
|
|
out.RawByte('{')
|
|
first := true
|
|
_ = first
|
|
{
|
|
const prefix string = ",\"id\":"
|
|
out.RawString(prefix[1:])
|
|
out.String(string(in.ID))
|
|
}
|
|
{
|
|
const prefix string = ",\"type\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.Type))
|
|
}
|
|
{
|
|
const prefix string = ",\"place_type\":"
|
|
out.RawString(prefix)
|
|
if in.PlaceType == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
out.RawString("null")
|
|
} else {
|
|
out.RawByte('[')
|
|
for v8, v9 := range in.PlaceType {
|
|
if v8 > 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.String(string(v9))
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
}
|
|
{
|
|
const prefix string = ",\"relevance\":"
|
|
out.RawString(prefix)
|
|
out.Float64(float64(in.Relevance))
|
|
}
|
|
{
|
|
const prefix string = ",\"properties\":"
|
|
out.RawString(prefix)
|
|
(in.Properties).MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"text\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.Text))
|
|
}
|
|
{
|
|
const prefix string = ",\"place_name\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.PlaceName))
|
|
}
|
|
{
|
|
const prefix string = ",\"center\":"
|
|
out.RawString(prefix)
|
|
if in.Center == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
out.RawString("null")
|
|
} else {
|
|
out.RawByte('[')
|
|
for v10, v11 := range in.Center {
|
|
if v10 > 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.Float64(float64(v11))
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
}
|
|
{
|
|
const prefix string = ",\"geometry\":"
|
|
out.RawString(prefix)
|
|
(in.Geometry).MarshalEasyJSON(out)
|
|
}
|
|
{
|
|
const prefix string = ",\"address\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.Address))
|
|
}
|
|
{
|
|
const prefix string = ",\"context\":"
|
|
out.RawString(prefix)
|
|
if in.Context == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
out.RawString("null")
|
|
} else {
|
|
out.RawByte('[')
|
|
for v12, v13 := range in.Context {
|
|
if v12 > 0 {
|
|
out.RawByte(',')
|
|
}
|
|
(v13).MarshalEasyJSON(out)
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
}
|
|
{
|
|
const prefix string = ",\"bbox\":"
|
|
out.RawString(prefix)
|
|
if in.BoundingBox == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
|
|
out.RawString("null")
|
|
} else {
|
|
out.RawByte('[')
|
|
for v14, v15 := range in.BoundingBox {
|
|
if v14 > 0 {
|
|
out.RawByte(',')
|
|
}
|
|
out.Float64(float64(v15))
|
|
}
|
|
out.RawByte(']')
|
|
}
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// MarshalJSON supports json.Marshaler interface
|
|
func (v Feature) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox2(&w, v)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
|
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
func (v Feature) MarshalEasyJSON(w *jwriter.Writer) {
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox2(w, v)
|
|
}
|
|
|
|
// UnmarshalJSON supports json.Unmarshaler interface
|
|
func (v *Feature) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox2(&r, v)
|
|
return r.Error()
|
|
}
|
|
|
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
func (v *Feature) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox2(l, v)
|
|
}
|
|
func easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox3(in *jlexer.Lexer, out *Context) {
|
|
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 "id":
|
|
out.ID = string(in.String())
|
|
case "text":
|
|
out.Text = string(in.String())
|
|
case "wikidata":
|
|
out.Wikidata = string(in.String())
|
|
case "short_code":
|
|
out.ShortCode = string(in.String())
|
|
default:
|
|
in.SkipRecursive()
|
|
}
|
|
in.WantComma()
|
|
}
|
|
in.Delim('}')
|
|
if isTopLevel {
|
|
in.Consumed()
|
|
}
|
|
}
|
|
func easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox3(out *jwriter.Writer, in Context) {
|
|
out.RawByte('{')
|
|
first := true
|
|
_ = first
|
|
{
|
|
const prefix string = ",\"id\":"
|
|
out.RawString(prefix[1:])
|
|
out.String(string(in.ID))
|
|
}
|
|
{
|
|
const prefix string = ",\"text\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.Text))
|
|
}
|
|
{
|
|
const prefix string = ",\"wikidata\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.Wikidata))
|
|
}
|
|
{
|
|
const prefix string = ",\"short_code\":"
|
|
out.RawString(prefix)
|
|
out.String(string(in.ShortCode))
|
|
}
|
|
out.RawByte('}')
|
|
}
|
|
|
|
// MarshalJSON supports json.Marshaler interface
|
|
func (v Context) MarshalJSON() ([]byte, error) {
|
|
w := jwriter.Writer{}
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox3(&w, v)
|
|
return w.Buffer.BuildBytes(), w.Error
|
|
}
|
|
|
|
// MarshalEasyJSON supports easyjson.Marshaler interface
|
|
func (v Context) MarshalEasyJSON(w *jwriter.Writer) {
|
|
easyjson3e8ab7adEncodeGithubComHumansNetMapboxSdkGoMapbox3(w, v)
|
|
}
|
|
|
|
// UnmarshalJSON supports json.Unmarshaler interface
|
|
func (v *Context) UnmarshalJSON(data []byte) error {
|
|
r := jlexer.Lexer{Data: data}
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox3(&r, v)
|
|
return r.Error()
|
|
}
|
|
|
|
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
|
|
func (v *Context) UnmarshalEasyJSON(l *jlexer.Lexer) {
|
|
easyjson3e8ab7adDecodeGithubComHumansNetMapboxSdkGoMapbox3(l, v)
|
|
}
|