// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. package server import ( json "encoding/json" config "github.com/khlieng/dispatch/config" storage "github.com/khlieng/dispatch/storage" 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 easyjson7e607aefDecodeGithubComKhliengDispatchServer(in *jlexer.Lexer, out *indexData) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "defaults": if data := in.Raw(); in.Ok() { in.AddError((out.Defaults).UnmarshalJSON(data)) } case "networks": if in.IsNull() { in.Skip() out.Networks = nil } else { in.Delim('[') if out.Networks == nil { if !in.IsDelim(']') { out.Networks = make([]*storage.Network, 0, 8) } else { out.Networks = []*storage.Network{} } } else { out.Networks = (out.Networks)[:0] } for !in.IsDelim(']') { var v1 *storage.Network if in.IsNull() { in.Skip() v1 = nil } else { if v1 == nil { v1 = new(storage.Network) } if data := in.Raw(); in.Ok() { in.AddError((*v1).UnmarshalJSON(data)) } } out.Networks = append(out.Networks, v1) in.WantComma() } in.Delim(']') } case "channels": if in.IsNull() { in.Skip() out.Channels = nil } else { in.Delim('[') if out.Channels == nil { if !in.IsDelim(']') { out.Channels = make([]*storage.Channel, 0, 8) } else { out.Channels = []*storage.Channel{} } } else { out.Channels = (out.Channels)[:0] } for !in.IsDelim(']') { var v2 *storage.Channel if in.IsNull() { in.Skip() v2 = nil } else { if v2 == nil { v2 = new(storage.Channel) } if data := in.Raw(); in.Ok() { in.AddError((*v2).UnmarshalJSON(data)) } } out.Channels = append(out.Channels, v2) in.WantComma() } in.Delim(']') } case "openDMs": if in.IsNull() { in.Skip() out.OpenDMs = nil } else { in.Delim('[') if out.OpenDMs == nil { if !in.IsDelim(']') { out.OpenDMs = make([]storage.Tab, 0, 2) } else { out.OpenDMs = []storage.Tab{} } } else { out.OpenDMs = (out.OpenDMs)[:0] } for !in.IsDelim(']') { var v3 storage.Tab easyjson7e607aefDecodeGithubComKhliengDispatchStorage(in, &v3) out.OpenDMs = append(out.OpenDMs, v3) in.WantComma() } in.Delim(']') } case "hexIP": out.HexIP = bool(in.Bool()) case "version": if data := in.Raw(); in.Ok() { in.AddError((out.Version).UnmarshalJSON(data)) } case "settings": if in.IsNull() { in.Skip() out.Settings = nil } else { if out.Settings == nil { out.Settings = new(storage.ClientSettings) } if data := in.Raw(); in.Ok() { in.AddError((*out.Settings).UnmarshalJSON(data)) } } case "users": if in.IsNull() { in.Skip() out.Users = nil } else { if out.Users == nil { out.Users = new(Userlist) } if data := in.Raw(); in.Ok() { in.AddError((*out.Users).UnmarshalJSON(data)) } } case "messages": if in.IsNull() { in.Skip() out.Messages = nil } else { if out.Messages == nil { out.Messages = new(Messages) } if data := in.Raw(); in.Ok() { in.AddError((*out.Messages).UnmarshalJSON(data)) } } default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjson7e607aefEncodeGithubComKhliengDispatchServer(out *jwriter.Writer, in indexData) { out.RawByte('{') first := true _ = first if true { const prefix string = ",\"defaults\":" first = false out.RawString(prefix[1:]) out.Raw((in.Defaults).MarshalJSON()) } if len(in.Networks) != 0 { const prefix string = ",\"networks\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } { out.RawByte('[') for v4, v5 := range in.Networks { if v4 > 0 { out.RawByte(',') } if v5 == nil { out.RawString("null") } else { out.Raw((*v5).MarshalJSON()) } } out.RawByte(']') } } if len(in.Channels) != 0 { const prefix string = ",\"channels\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } { out.RawByte('[') for v6, v7 := range in.Channels { if v6 > 0 { out.RawByte(',') } if v7 == nil { out.RawString("null") } else { out.Raw((*v7).MarshalJSON()) } } out.RawByte(']') } } if len(in.OpenDMs) != 0 { const prefix string = ",\"openDMs\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } { out.RawByte('[') for v8, v9 := range in.OpenDMs { if v8 > 0 { out.RawByte(',') } easyjson7e607aefEncodeGithubComKhliengDispatchStorage(out, v9) } out.RawByte(']') } } if in.HexIP { const prefix string = ",\"hexIP\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Bool(bool(in.HexIP)) } if true { const prefix string = ",\"version\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Raw((in.Version).MarshalJSON()) } if in.Settings != nil { const prefix string = ",\"settings\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Raw((*in.Settings).MarshalJSON()) } if in.Users != nil { const prefix string = ",\"users\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Raw((*in.Users).MarshalJSON()) } if in.Messages != nil { const prefix string = ",\"messages\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Raw((*in.Messages).MarshalJSON()) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v indexData) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson7e607aefEncodeGithubComKhliengDispatchServer(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v indexData) MarshalEasyJSON(w *jwriter.Writer) { easyjson7e607aefEncodeGithubComKhliengDispatchServer(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *indexData) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson7e607aefDecodeGithubComKhliengDispatchServer(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *indexData) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson7e607aefDecodeGithubComKhliengDispatchServer(l, v) } func easyjson7e607aefDecodeGithubComKhliengDispatchStorage(in *jlexer.Lexer, out *storage.Tab) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "network": out.Network = string(in.String()) case "name": out.Name = string(in.String()) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjson7e607aefEncodeGithubComKhliengDispatchStorage(out *jwriter.Writer, in storage.Tab) { out.RawByte('{') first := true _ = first if in.Network != "" { const prefix string = ",\"network\":" first = false out.RawString(prefix[1:]) out.String(string(in.Network)) } if in.Name != "" { const prefix string = ",\"name\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.String(string(in.Name)) } out.RawByte('}') } func easyjson7e607aefDecodeGithubComKhliengDispatchServer1(in *jlexer.Lexer, out *dispatchVersion) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "tag": out.Tag = string(in.String()) case "commit": out.Commit = string(in.String()) case "date": out.Date = string(in.String()) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjson7e607aefEncodeGithubComKhliengDispatchServer1(out *jwriter.Writer, in dispatchVersion) { out.RawByte('{') first := true _ = first if in.Tag != "" { const prefix string = ",\"tag\":" first = false out.RawString(prefix[1:]) out.String(string(in.Tag)) } if in.Commit != "" { const prefix string = ",\"commit\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.String(string(in.Commit)) } if in.Date != "" { const prefix string = ",\"date\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.String(string(in.Date)) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v dispatchVersion) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson7e607aefEncodeGithubComKhliengDispatchServer1(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v dispatchVersion) MarshalEasyJSON(w *jwriter.Writer) { easyjson7e607aefEncodeGithubComKhliengDispatchServer1(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *dispatchVersion) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson7e607aefDecodeGithubComKhliengDispatchServer1(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *dispatchVersion) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson7e607aefDecodeGithubComKhliengDispatchServer1(l, v) } func easyjson7e607aefDecodeGithubComKhliengDispatchServer2(in *jlexer.Lexer, out *connectDefaults) { isTopLevel := in.IsStart() if in.IsNull() { if isTopLevel { in.Consumed() } in.Skip() return } out.Defaults = new(config.Defaults) in.Delim('{') for !in.IsDelim('}') { key := in.UnsafeFieldName(false) in.WantColon() if in.IsNull() { in.Skip() in.WantComma() continue } switch key { case "serverPassword": out.ServerPassword = bool(in.Bool()) case "name": out.Name = string(in.String()) case "host": out.Host = string(in.String()) case "port": out.Port = string(in.String()) case "channels": if in.IsNull() { in.Skip() out.Channels = nil } else { in.Delim('[') if out.Channels == nil { if !in.IsDelim(']') { out.Channels = make([]string, 0, 4) } else { out.Channels = []string{} } } else { out.Channels = (out.Channels)[:0] } for !in.IsDelim(']') { var v10 string v10 = string(in.String()) out.Channels = append(out.Channels, v10) in.WantComma() } in.Delim(']') } case "ssl": out.SSL = bool(in.Bool()) case "readOnly": out.ReadOnly = bool(in.Bool()) case "showDetails": out.ShowDetails = bool(in.Bool()) default: in.SkipRecursive() } in.WantComma() } in.Delim('}') if isTopLevel { in.Consumed() } } func easyjson7e607aefEncodeGithubComKhliengDispatchServer2(out *jwriter.Writer, in connectDefaults) { out.RawByte('{') first := true _ = first if in.ServerPassword { const prefix string = ",\"serverPassword\":" first = false out.RawString(prefix[1:]) out.Bool(bool(in.ServerPassword)) } if in.Name != "" { const prefix string = ",\"name\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.String(string(in.Name)) } if in.Host != "" { const prefix string = ",\"host\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.String(string(in.Host)) } if in.Port != "" { const prefix string = ",\"port\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.String(string(in.Port)) } if len(in.Channels) != 0 { const prefix string = ",\"channels\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } { out.RawByte('[') for v11, v12 := range in.Channels { if v11 > 0 { out.RawByte(',') } out.String(string(v12)) } out.RawByte(']') } } if in.SSL { const prefix string = ",\"ssl\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Bool(bool(in.SSL)) } if in.ReadOnly { const prefix string = ",\"readOnly\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Bool(bool(in.ReadOnly)) } if in.ShowDetails { const prefix string = ",\"showDetails\":" if first { first = false out.RawString(prefix[1:]) } else { out.RawString(prefix) } out.Bool(bool(in.ShowDetails)) } out.RawByte('}') } // MarshalJSON supports json.Marshaler interface func (v connectDefaults) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} easyjson7e607aefEncodeGithubComKhliengDispatchServer2(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v connectDefaults) MarshalEasyJSON(w *jwriter.Writer) { easyjson7e607aefEncodeGithubComKhliengDispatchServer2(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *connectDefaults) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} easyjson7e607aefDecodeGithubComKhliengDispatchServer2(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *connectDefaults) UnmarshalEasyJSON(l *jlexer.Lexer) { easyjson7e607aefDecodeGithubComKhliengDispatchServer2(l, v) }