dispatch/server/index_data_easyjson.go

803 lines
17 KiB
Go
Raw Normal View History

2018-05-25 21:54:36 +00:00
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package server
import (
json "encoding/json"
2018-12-11 09:51:20 +00:00
config "github.com/khlieng/dispatch/config"
2018-05-25 21:54:36 +00:00
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.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "defaults":
2018-12-11 09:51:20 +00:00
if in.IsNull() {
in.Skip()
out.Defaults = nil
} else {
if out.Defaults == nil {
out.Defaults = new(config.Defaults)
}
easyjson7e607aefDecodeGithubComKhliengDispatchConfig(in, &*out.Defaults)
2018-05-25 21:54:36 +00:00
}
case "servers":
if in.IsNull() {
in.Skip()
out.Servers = nil
} else {
in.Delim('[')
if out.Servers == nil {
if !in.IsDelim(']') {
out.Servers = make([]Server, 0, 1)
} else {
out.Servers = []Server{}
}
} else {
out.Servers = (out.Servers)[:0]
}
for !in.IsDelim(']') {
var v1 Server
if data := in.Raw(); in.Ok() {
in.AddError((v1).UnmarshalJSON(data))
}
out.Servers = append(out.Servers, 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)
2018-05-25 21:54:36 +00:00
} else {
out.Channels = []*storage.Channel{}
2018-05-25 21:54:36 +00:00
}
} 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)
}
easyjson7e607aefDecodeGithubComKhliengDispatchStorage(in, &*v2)
}
2018-05-25 21:54:36 +00:00
out.Channels = append(out.Channels, v2)
in.WantComma()
}
in.Delim(']')
}
case "hexIP":
out.HexIP = bool(in.Bool())
2018-11-22 11:00:18 +00:00
case "version":
if data := in.Raw(); in.Ok() {
in.AddError((out.Version).UnmarshalJSON(data))
}
2018-10-15 06:56:17 +00:00
case "settings":
if in.IsNull() {
in.Skip()
out.Settings = nil
} else {
if out.Settings == nil {
out.Settings = new(storage.ClientSettings)
}
2018-11-22 11:00:18 +00:00
if data := in.Raw(); in.Ok() {
in.AddError((*out.Settings).UnmarshalJSON(data))
}
2018-10-15 06:56:17 +00:00
}
2018-05-25 21:54:36 +00:00
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
2018-12-11 09:51:20 +00:00
if in.Defaults != nil {
2018-05-25 21:54:36 +00:00
const prefix string = ",\"defaults\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
2018-12-11 09:51:20 +00:00
easyjson7e607aefEncodeGithubComKhliengDispatchConfig(out, *in.Defaults)
2018-05-25 21:54:36 +00:00
}
if len(in.Servers) != 0 {
const prefix string = ",\"servers\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
{
out.RawByte('[')
for v3, v4 := range in.Servers {
if v3 > 0 {
out.RawByte(',')
}
out.Raw((v4).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 v5, v6 := range in.Channels {
if v5 > 0 {
out.RawByte(',')
}
if v6 == nil {
out.RawString("null")
} else {
easyjson7e607aefEncodeGithubComKhliengDispatchStorage(out, *v6)
}
2018-05-25 21:54:36 +00:00
}
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))
}
2018-11-22 11:00:18 +00:00
if true {
const prefix string = ",\"version\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Raw((in.Version).MarshalJSON())
}
2018-10-15 06:56:17 +00:00
if in.Settings != nil {
const prefix string = ",\"settings\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
2018-11-22 11:00:18 +00:00
out.Raw((*in.Settings).MarshalJSON())
2018-10-15 06:56:17 +00:00
}
2018-05-25 21:54:36 +00:00
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)
}
2018-11-22 11:00:18 +00:00
func easyjson7e607aefDecodeGithubComKhliengDispatchStorage(in *jlexer.Lexer, out *storage.Channel) {
2018-10-15 06:56:17 +00:00
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 {
2018-11-22 11:00:18 +00:00
case "server":
out.Server = string(in.String())
case "name":
out.Name = string(in.String())
case "topic":
out.Topic = string(in.String())
2018-10-15 06:56:17 +00:00
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
2018-11-22 11:00:18 +00:00
func easyjson7e607aefEncodeGithubComKhliengDispatchStorage(out *jwriter.Writer, in storage.Channel) {
2018-10-15 06:56:17 +00:00
out.RawByte('{')
first := true
_ = first
2018-11-22 11:00:18 +00:00
if in.Server != "" {
const prefix string = ",\"server\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Server))
}
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.Topic != "" {
const prefix string = ",\"topic\":"
2018-10-15 06:56:17 +00:00
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
2018-11-22 11:00:18 +00:00
out.String(string(in.Topic))
2018-10-15 06:56:17 +00:00
}
out.RawByte('}')
}
2018-12-11 09:51:20 +00:00
func easyjson7e607aefDecodeGithubComKhliengDispatchConfig(in *jlexer.Lexer, out *config.Defaults) {
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 "name":
out.Name = string(in.String())
case "host":
out.Host = string(in.String())
case "port":
out.Port = int(in.Int())
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 v7 string
v7 = string(in.String())
out.Channels = append(out.Channels, v7)
in.WantComma()
}
in.Delim(']')
}
case "password":
out.Password = string(in.String())
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 easyjson7e607aefEncodeGithubComKhliengDispatchConfig(out *jwriter.Writer, in config.Defaults) {
out.RawByte('{')
first := true
_ = first
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 != 0 {
const prefix string = ",\"port\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int(int(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 v8, v9 := range in.Channels {
if v8 > 0 {
out.RawByte(',')
}
out.String(string(v9))
}
out.RawByte(']')
}
}
if in.Password != "" {
const prefix string = ",\"password\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Password))
}
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('}')
}
2018-11-22 11:00:18 +00:00
func easyjson7e607aefDecodeGithubComKhliengDispatchServer1(in *jlexer.Lexer, out *dispatchVersion) {
2018-05-25 21:54:36 +00:00
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 {
2018-11-22 11:00:18 +00:00
case "tag":
out.Tag = string(in.String())
case "commit":
out.Commit = string(in.String())
case "date":
out.Date = string(in.String())
2018-05-25 21:54:36 +00:00
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
2018-11-22 11:00:18 +00:00
func easyjson7e607aefEncodeGithubComKhliengDispatchServer1(out *jwriter.Writer, in dispatchVersion) {
2018-05-25 21:54:36 +00:00
out.RawByte('{')
first := true
_ = first
2018-11-22 11:00:18 +00:00
if in.Tag != "" {
const prefix string = ",\"tag\":"
2018-05-25 21:54:36 +00:00
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
2018-11-22 11:00:18 +00:00
out.String(string(in.Tag))
2018-05-25 21:54:36 +00:00
}
2018-11-22 11:00:18 +00:00
if in.Commit != "" {
const prefix string = ",\"commit\":"
2018-05-25 21:54:36 +00:00
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
2018-11-22 11:00:18 +00:00
out.String(string(in.Commit))
2018-05-25 21:54:36 +00:00
}
2018-11-22 11:00:18 +00:00
if in.Date != "" {
const prefix string = ",\"date\":"
2018-05-25 21:54:36 +00:00
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
2018-11-22 11:00:18 +00:00
out.String(string(in.Date))
2018-05-25 21:54:36 +00:00
}
out.RawByte('}')
}
2018-11-22 11:00:18 +00:00
// 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) {
2018-05-25 21:54:36 +00:00
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 "name":
out.Name = string(in.String())
case "host":
out.Host = string(in.String())
case "port":
out.Port = int(in.Int())
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(']') {
2018-12-11 09:51:20 +00:00
var v10 string
v10 = string(in.String())
out.Channels = append(out.Channels, v10)
2018-05-25 21:54:36 +00:00
in.WantComma()
}
in.Delim(']')
}
case "password":
out.Password = bool(in.Bool())
case "ssl":
out.SSL = bool(in.Bool())
case "readOnly":
2018-05-25 21:54:36 +00:00
out.ReadOnly = bool(in.Bool())
case "showDetails":
out.ShowDetails = bool(in.Bool())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
2018-11-22 11:00:18 +00:00
func easyjson7e607aefEncodeGithubComKhliengDispatchServer2(out *jwriter.Writer, in connectDefaults) {
2018-05-25 21:54:36 +00:00
out.RawByte('{')
first := true
_ = first
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 != 0 {
const prefix string = ",\"port\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int(int(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('[')
2018-12-11 09:51:20 +00:00
for v11, v12 := range in.Channels {
if v11 > 0 {
2018-05-25 21:54:36 +00:00
out.RawByte(',')
}
2018-12-11 09:51:20 +00:00
out.String(string(v12))
2018-05-25 21:54:36 +00:00
}
out.RawByte(']')
}
}
if in.Password {
const prefix string = ",\"password\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Bool(bool(in.Password))
}
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\":"
2018-05-25 21:54:36 +00:00
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{}
2018-11-22 11:00:18 +00:00
easyjson7e607aefEncodeGithubComKhliengDispatchServer2(&w, v)
2018-05-25 21:54:36 +00:00
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v connectDefaults) MarshalEasyJSON(w *jwriter.Writer) {
2018-11-22 11:00:18 +00:00
easyjson7e607aefEncodeGithubComKhliengDispatchServer2(w, v)
2018-05-25 21:54:36 +00:00
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *connectDefaults) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
2018-11-22 11:00:18 +00:00
easyjson7e607aefDecodeGithubComKhliengDispatchServer2(&r, v)
2018-05-25 21:54:36 +00:00
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *connectDefaults) UnmarshalEasyJSON(l *jlexer.Lexer) {
2018-11-22 11:00:18 +00:00
easyjson7e607aefDecodeGithubComKhliengDispatchServer2(l, v)
2018-05-25 21:54:36 +00:00
}