Ctrl K
ComunidadGuías…

models_easyjson.go

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.

package main

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 easyjsonD2b7633eDecodeNanostatusNanostat(in *jlexer.Lexer, out *StatsResponse) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		switch key {
		case "overallUptime":
			if in.IsNull() {
				in.Skip()
			} else {
				out.OverallUptime = float64(in.Float64())
			}
		case "servicesUp":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ServicesUp = int(in.Int())
			}
		case "servicesDown":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ServicesDown = int(in.Int())
			}
		case "avgResponseTime":
			if in.IsNull() {
				in.Skip()
			} else {
				out.AvgResponseTime = int(in.Int())
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonD2b7633eEncodeNanostatusNanostat(out *jwriter.Writer, in StatsResponse) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"overallUptime\":"
		out.RawString(prefix[1:])
		out.Float64(float64(in.OverallUptime))
	}
	{
		const prefix string = ",\"servicesUp\":"
		out.RawString(prefix)
		out.Int(int(in.ServicesUp))
	}
	{
		const prefix string = ",\"servicesDown\":"
		out.RawString(prefix)
		out.Int(int(in.ServicesDown))
	}
	{
		const prefix string = ",\"avgResponseTime\":"
		out.RawString(prefix)
		out.Int(int(in.AvgResponseTime))
	}
	out.RawByte('}')
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v StatsResponse) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonD2b7633eEncodeNanostatusNanostat(w, v)
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *StatsResponse) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonD2b7633eDecodeNanostatusNanostat(l, v)
}
func easyjsonD2b7633eDecodeNanostatusNanostat1(in *jlexer.Lexer, out *ResponseTimeData) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		switch key {
		case "time":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Time = string(in.String())
			}
		case "timestamp":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Timestamp = string(in.String())
			}
		case "responseTime":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ResponseTime = float64(in.Float64())
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonD2b7633eEncodeNanostatusNanostat1(out *jwriter.Writer, in ResponseTimeData) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"time\":"
		out.RawString(prefix[1:])
		out.String(string(in.Time))
	}
	{
		const prefix string = ",\"timestamp\":"
		out.RawString(prefix)
		out.String(string(in.Timestamp))
	}
	{
		const prefix string = ",\"responseTime\":"
		out.RawString(prefix)
		out.Float64(float64(in.ResponseTime))
	}
	out.RawByte('}')
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResponseTimeData) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonD2b7633eEncodeNanostatusNanostat1(w, v)
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResponseTimeData) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonD2b7633eDecodeNanostatusNanostat1(l, v)
}
func easyjsonD2b7633eDecodeNanostatusNanostat2(in *jlexer.Lexer, out *Monitor) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		switch key {
		case "id":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ID = uint(in.Uint())
			}
		case "name":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Name = string(in.String())
			}
		case "url":
			if in.IsNull() {
				in.Skip()
			} else {
				out.URL = string(in.String())
			}
		case "uptime":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Uptime = float64(in.Float64())
			}
		case "status":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Status = string(in.String())
			}
		case "responseTime":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ResponseTime = int(in.Int())
			}
		case "lastCheck":
			if in.IsNull() {
				in.Skip()
			} else {
				out.LastCheck = string(in.String())
			}
		case "isThirdParty":
			if in.IsNull() {
				in.Skip()
			} else {
				out.IsThirdParty = bool(in.Bool())
			}
		case "icon":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Icon = string(in.String())
			}
		case "checkInterval":
			if in.IsNull() {
				in.Skip()
			} else {
				out.CheckInterval = int(in.Int())
			}
		case "paused":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Paused = bool(in.Bool())
			}
		case "configHash":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ConfigHash = string(in.String())
			}
		case "createdAt":
			if in.IsNull() {
				in.Skip()
			} else {
				if data := in.Raw(); in.Ok() {
					in.AddError((out.CreatedAt).UnmarshalJSON(data))
				}
			}
		case "updatedAt":
			if in.IsNull() {
				in.Skip()
			} else {
				if data := in.Raw(); in.Ok() {
					in.AddError((out.UpdatedAt).UnmarshalJSON(data))
				}
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonD2b7633eEncodeNanostatusNanostat2(out *jwriter.Writer, in Monitor) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"id\":"
		out.RawString(prefix[1:])
		out.Uint(uint(in.ID))
	}
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix)
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"url\":"
		out.RawString(prefix)
		out.String(string(in.URL))
	}
	{
		const prefix string = ",\"uptime\":"
		out.RawString(prefix)
		out.Float64(float64(in.Uptime))
	}
	{
		const prefix string = ",\"status\":"
		out.RawString(prefix)
		out.String(string(in.Status))
	}
	{
		const prefix string = ",\"responseTime\":"
		out.RawString(prefix)
		out.Int(int(in.ResponseTime))
	}
	{
		const prefix string = ",\"lastCheck\":"
		out.RawString(prefix)
		out.String(string(in.LastCheck))
	}
	if in.IsThirdParty {
		const prefix string = ",\"isThirdParty\":"
		out.RawString(prefix)
		out.Bool(bool(in.IsThirdParty))
	}
	if in.Icon != "" {
		const prefix string = ",\"icon\":"
		out.RawString(prefix)
		out.String(string(in.Icon))
	}
	{
		const prefix string = ",\"checkInterval\":"
		out.RawString(prefix)
		out.Int(int(in.CheckInterval))
	}
	{
		const prefix string = ",\"paused\":"
		out.RawString(prefix)
		out.Bool(bool(in.Paused))
	}
	if in.ConfigHash != "" {
		const prefix string = ",\"configHash\":"
		out.RawString(prefix)
		out.String(string(in.ConfigHash))
	}
	{
		const prefix string = ",\"createdAt\":"
		out.RawString(prefix)
		out.Raw((in.CreatedAt).MarshalJSON())
	}
	{
		const prefix string = ",\"updatedAt\":"
		out.RawString(prefix)
		out.Raw((in.UpdatedAt).MarshalJSON())
	}
	out.RawByte('}')
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Monitor) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonD2b7633eEncodeNanostatusNanostat2(w, v)
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Monitor) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonD2b7633eDecodeNanostatusNanostat2(l, v)
}
func easyjsonD2b7633eDecodeNanostatusNanostat3(in *jlexer.Lexer, out *CreateMonitorRequest) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		switch key {
		case "name":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Name = string(in.String())
			}
		case "url":
			if in.IsNull() {
				in.Skip()
			} else {
				out.URL = string(in.String())
			}
		case "isThirdParty":
			if in.IsNull() {
				in.Skip()
			} else {
				out.IsThirdParty = bool(in.Bool())
			}
		case "icon":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Icon = string(in.String())
			}
		case "checkInterval":
			if in.IsNull() {
				in.Skip()
			} else {
				out.CheckInterval = int(in.Int())
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonD2b7633eEncodeNanostatusNanostat3(out *jwriter.Writer, in CreateMonitorRequest) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"name\":"
		out.RawString(prefix[1:])
		out.String(string(in.Name))
	}
	{
		const prefix string = ",\"url\":"
		out.RawString(prefix)
		out.String(string(in.URL))
	}
	if in.IsThirdParty {
		const prefix string = ",\"isThirdParty\":"
		out.RawString(prefix)
		out.Bool(bool(in.IsThirdParty))
	}
	if in.Icon != "" {
		const prefix string = ",\"icon\":"
		out.RawString(prefix)
		out.String(string(in.Icon))
	}
	if in.CheckInterval != 0 {
		const prefix string = ",\"checkInterval\":"
		out.RawString(prefix)
		out.Int(int(in.CheckInterval))
	}
	out.RawByte('}')
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CreateMonitorRequest) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonD2b7633eEncodeNanostatusNanostat3(w, v)
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CreateMonitorRequest) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonD2b7633eDecodeNanostatusNanostat3(l, v)
}
func easyjsonD2b7633eDecodeNanostatusNanostat4(in *jlexer.Lexer, out *CheckHistory) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		switch key {
		case "ID":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ID = uint(in.Uint())
			}
		case "MonitorID":
			if in.IsNull() {
				in.Skip()
			} else {
				out.MonitorID = uint(in.Uint())
			}
		case "Status":
			if in.IsNull() {
				in.Skip()
			} else {
				out.Status = string(in.String())
			}
		case "ResponseTime":
			if in.IsNull() {
				in.Skip()
			} else {
				out.ResponseTime = int(in.Int())
			}
		case "CreatedAt":
			if in.IsNull() {
				in.Skip()
			} else {
				if data := in.Raw(); in.Ok() {
					in.AddError((out.CreatedAt).UnmarshalJSON(data))
				}
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjsonD2b7633eEncodeNanostatusNanostat4(out *jwriter.Writer, in CheckHistory) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"ID\":"
		out.RawString(prefix[1:])
		out.Uint(uint(in.ID))
	}
	{
		const prefix string = ",\"MonitorID\":"
		out.RawString(prefix)
		out.Uint(uint(in.MonitorID))
	}
	{
		const prefix string = ",\"Status\":"
		out.RawString(prefix)
		out.String(string(in.Status))
	}
	{
		const prefix string = ",\"ResponseTime\":"
		out.RawString(prefix)
		out.Int(int(in.ResponseTime))
	}
	{
		const prefix string = ",\"CreatedAt\":"
		out.RawString(prefix)
		out.Raw((in.CreatedAt).MarshalJSON())
	}
	out.RawByte('}')
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CheckHistory) MarshalEasyJSON(w *jwriter.Writer) {
	easyjsonD2b7633eEncodeNanostatusNanostat4(w, v)
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CheckHistory) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjsonD2b7633eDecodeNanostatusNanostat4(l, v)
}