func (mj *InMsg) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"type":`)
	fflib.WriteJsonString(buf, string(mj.Type))
	buf.WriteString(`,"data":`)

	{

		obj, err = mj.Data.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)

	}
	buf.WriteByte('}')
	return nil
}
Exemple #2
0
func (mj *LogFormat) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Prefix":`)
	fflib.WriteJsonString(buf, string(mj.Prefix))
	buf.WriteString(`,"Time":`)

	{

		obj, err = mj.Time.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)

	}
	buf.WriteString(`,"Host":`)
	fflib.WriteJsonString(buf, string(mj.Host))
	buf.WriteString(`,"Level":`)
	fflib.FormatBits2(buf, uint64(mj.Level), 10, false)
	buf.WriteString(`,"Msg":`)
	fflib.WriteJsonString(buf, string(mj.Msg))
	buf.WriteString(`,"Caller":`)
	fflib.WriteJsonString(buf, string(mj.Caller))
	buf.WriteString(`,"LineNo":`)
	fflib.FormatBits2(buf, uint64(mj.LineNo), 10, mj.LineNo < 0)
	buf.WriteByte('}')
	return nil
}
Exemple #3
0
func (mj *Entry) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	var scratch fflib.FormatBitsScratch
	_ = scratch
	_ = obj
	_ = err
	buf.WriteString(`{ "manufacturer":`)
	fflib.WriteJsonString(buf, string(mj.Manufacturer))
	buf.WriteString(`,"address":`)
	if mj.Address != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Address {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.WriteJsonString(buf, string(v))
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"prefix":`)

	{
		obj, err = mj.Prefix.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)
	}

	buf.WriteByte(',')
	if len(mj.Country) != 0 {
		buf.WriteString(`"country":`)
		fflib.WriteJsonString(buf, string(mj.Country))
		buf.WriteByte(',')
	}
	if mj.Local != false {
		if mj.Local {
			buf.WriteString(`"local":true`)
		} else {
			buf.WriteString(`"local":false`)
		}
		buf.WriteByte(',')
	}
	if mj.Multicast != false {
		if mj.Multicast {
			buf.WriteString(`"multicast":true`)
		} else {
			buf.WriteString(`"multicast":false`)
		}
		buf.WriteByte(',')
	}
	buf.Rewind(1)
	buf.WriteByte('}')
	return nil
}
func (mj *Location) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	var scratch fflib.FormatBitsScratch
	_ = scratch
	_ = obj
	_ = err
	buf.WriteString(`{"Latitude":`)
	buf.Write(strconv.AppendFloat([]byte{}, mj.Latitude, 'g', -1, 64))
	buf.WriteString(`,"Longitude":`)
	buf.Write(strconv.AppendFloat([]byte{}, mj.Longitude, 'g', -1, 64))
	buf.WriteString(`,"MetroCode":`)
	fflib.FormatBits(&scratch, buf, uint64(mj.MetroCode), 10, false)
	buf.WriteString(`,"TimeZone":`)
	fflib.WriteJsonString(buf, string(mj.TimeZone))
	buf.WriteByte('}')
	return nil
}
Exemple #5
0
func (mj *Topic) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"option-a":`)
	fflib.WriteJsonString(buf, string(mj.OptionA))
	buf.WriteString(`,"option-b":`)
	fflib.WriteJsonString(buf, string(mj.OptionB))
	buf.WriteString(`,"id":`)
	fflib.FormatBits2(buf, uint64(mj.ID), 10, mj.ID < 0)
	buf.WriteString(`,"created":`)

	{

		obj, err = mj.Created.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)

	}
	buf.WriteString(`,"ends":`)

	{

		obj, err = mj.Ends.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)

	}
	buf.WriteByte('}')
	return nil
}
func (mj *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"ID":`)
	fflib.FormatBits2(buf, uint64(mj.ID), 10, mj.ID < 0)
	buf.WriteString(`,"Name":`)
	fflib.WriteJsonString(buf, string(mj.Name))
	buf.WriteString(`,"Age":`)
	fflib.FormatBits2(buf, uint64(mj.Age), 10, mj.Age < 0)
	buf.WriteString(`,"Created":`)

	{
		obj, err = mj.Created.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)
	}

	buf.WriteByte('}')
	return nil
}
func (mj *Character) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"character_id":`)
	fflib.WriteJsonString(buf, string(mj.ID))
	/* Inline struct. type=struct { First string "json:\"first\""; Lower string "json:\"first_lower\"" } kind=struct */
	buf.WriteString(`,"name":{ "first":`)
	fflib.WriteJsonString(buf, string(mj.Name.First))
	buf.WriteString(`,"first_lower":`)
	fflib.WriteJsonString(buf, string(mj.Name.Lower))
	buf.WriteByte('}')
	buf.WriteString(`,"faction_id":`)
	fflib.WriteJsonString(buf, string(mj.FactionID))
	buf.WriteString(`,"title_id":`)
	fflib.WriteJsonString(buf, string(mj.TitleID))
	/* Inline struct. type=struct { Creation string "json:\"creation\""; LastSave string "json:\"last_save\""; LastLogin string "json:\"last_login\""; LoginCount string "json:\"login_count\""; MinutesPlayed string "json:\"minutes_played\"" } kind=struct */
	buf.WriteString(`,"times":{ "creation":`)
	fflib.WriteJsonString(buf, string(mj.Times.Creation))
	buf.WriteString(`,"last_save":`)
	fflib.WriteJsonString(buf, string(mj.Times.LastSave))
	buf.WriteString(`,"last_login":`)
	fflib.WriteJsonString(buf, string(mj.Times.LastLogin))
	buf.WriteString(`,"login_count":`)
	fflib.WriteJsonString(buf, string(mj.Times.LoginCount))
	buf.WriteString(`,"minutes_played":`)
	fflib.WriteJsonString(buf, string(mj.Times.MinutesPlayed))
	buf.WriteByte('}')
	/* Inline struct. type=struct { Earned string "json:\"earned_points\""; Gifted string "json:\"gifted_points\""; Spent string "json:\"spent_points\""; Available string "json:\"available_points\""; PercentToNext string "json:\"percent_to_next\"" } kind=struct */
	buf.WriteString(`,"certs":{ "earned_points":`)
	fflib.WriteJsonString(buf, string(mj.Certs.Earned))
	buf.WriteString(`,"gifted_points":`)
	fflib.WriteJsonString(buf, string(mj.Certs.Gifted))
	buf.WriteString(`,"spent_points":`)
	fflib.WriteJsonString(buf, string(mj.Certs.Spent))
	buf.WriteString(`,"available_points":`)
	fflib.WriteJsonString(buf, string(mj.Certs.Available))
	buf.WriteString(`,"percent_to_next":`)
	fflib.WriteJsonString(buf, string(mj.Certs.PercentToNext))
	buf.WriteByte('}')
	/* Inline struct. type=struct { Rank string "json:\"value\""; PercentToNext string "json:\"percent_to_next\"" } kind=struct */
	buf.WriteString(`,"battle_rank":{ "value":`)
	fflib.WriteJsonString(buf, string(mj.Battlerank.Rank))
	buf.WriteString(`,"percent_to_next":`)
	fflib.WriteJsonString(buf, string(mj.Battlerank.PercentToNext))
	buf.WriteByte('}')
	/* Inline struct. type=struct { Count string "json:\"count\""; Time string "json:\"time\"" } kind=struct */
	buf.WriteString(`,"daily_ribbon":{ "count":`)
	fflib.WriteJsonString(buf, string(mj.DailyRibbon.Count))
	buf.WriteString(`,"time":`)
	fflib.WriteJsonString(buf, string(mj.DailyRibbon.Time))
	buf.WriteByte('}')
	buf.WriteString(`,"profile_id":`)
	fflib.WriteJsonString(buf, string(mj.ProfileID))
	/* Inline struct. type=struct { ID string "json:\"outfit_id\""; Name string "json:\"name\""; Alias string "json:\"alias\""; LeaderID string "json:\"leader_character_id\""; MemberCount string "json:\"member_count\""; TimeCreated string "json:\"time_created\"" } kind=struct */
	buf.WriteString(`,"outfit":{ "outfit_id":`)
	fflib.WriteJsonString(buf, string(mj.Outfit.ID))
	buf.WriteString(`,"name":`)
	fflib.WriteJsonString(buf, string(mj.Outfit.Name))
	buf.WriteString(`,"alias":`)
	fflib.WriteJsonString(buf, string(mj.Outfit.Alias))
	buf.WriteString(`,"leader_character_id":`)
	fflib.WriteJsonString(buf, string(mj.Outfit.LeaderID))
	buf.WriteString(`,"member_count":`)
	fflib.WriteJsonString(buf, string(mj.Outfit.MemberCount))
	buf.WriteString(`,"time_created":`)
	fflib.WriteJsonString(buf, string(mj.Outfit.TimeCreated))
	buf.WriteByte('}')
	buf.WriteString(`,"online_status":`)
	fflib.WriteJsonString(buf, string(mj.OnlineStatus))
	/* Inline struct. type=struct { Stat []struct { Name string "json:\"stat_name\""; ProfileID string "json:\"profile_id\""; ValueForever string "json:\"value_forever\""; ValueMonthly string "json:\"value_monthly\""; ValueWeekly string "json:\"value_weekly\""; ValueDaily string "json:\"value_daily\""; ValueOneLifeMax string "json:\"value_one_life_max\""; LastSave string "json:\"last_save\"" } "json:\"stat\""; StatHistory []struct { Name string "json:\"stat_name\""; AllTime string "json:\"all_time\""; OneLifeMax string "json:\"one_life_max\""; Day map[string]string "json:\"day\""; Month map[string]string "json:\"Month\""; Week map[string]string "json:\"Week\"" } "json:\"stat_history\""; WeaponStat []struct { Name string "json:\"weapon_deaths\""; ItemID string "json:\"item_id\""; VehicleID string "json:\"vehicle_id\""; Value string "json:\"value\""; LastSave string "json:\"last_save\"" } "json:\"weapon_stat\"" } kind=struct */
	buf.WriteString(`,"stats":{ "stat":`)
	if mj.Stats.Stat != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Stats.Stat {
			if i != 0 {
				buf.WriteString(`,`)
			}
			/* Inline struct. type=struct { Name string "json:\"stat_name\""; ProfileID string "json:\"profile_id\""; ValueForever string "json:\"value_forever\""; ValueMonthly string "json:\"value_monthly\""; ValueWeekly string "json:\"value_weekly\""; ValueDaily string "json:\"value_daily\""; ValueOneLifeMax string "json:\"value_one_life_max\""; LastSave string "json:\"last_save\"" } kind=struct */
			buf.WriteString(`{ "stat_name":`)
			fflib.WriteJsonString(buf, string(v.Name))
			buf.WriteString(`,"profile_id":`)
			fflib.WriteJsonString(buf, string(v.ProfileID))
			buf.WriteString(`,"value_forever":`)
			fflib.WriteJsonString(buf, string(v.ValueForever))
			buf.WriteString(`,"value_monthly":`)
			fflib.WriteJsonString(buf, string(v.ValueMonthly))
			buf.WriteString(`,"value_weekly":`)
			fflib.WriteJsonString(buf, string(v.ValueWeekly))
			buf.WriteString(`,"value_daily":`)
			fflib.WriteJsonString(buf, string(v.ValueDaily))
			buf.WriteString(`,"value_one_life_max":`)
			fflib.WriteJsonString(buf, string(v.ValueOneLifeMax))
			buf.WriteString(`,"last_save":`)
			fflib.WriteJsonString(buf, string(v.LastSave))
			buf.WriteByte('}')
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"stat_history":`)
	if mj.Stats.StatHistory != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Stats.StatHistory {
			if i != 0 {
				buf.WriteString(`,`)
			}
			/* Inline struct. type=struct { Name string "json:\"stat_name\""; AllTime string "json:\"all_time\""; OneLifeMax string "json:\"one_life_max\""; Day map[string]string "json:\"day\""; Month map[string]string "json:\"Month\""; Week map[string]string "json:\"Week\"" } kind=struct */
			buf.WriteString(`{ "stat_name":`)
			fflib.WriteJsonString(buf, string(v.Name))
			buf.WriteString(`,"all_time":`)
			fflib.WriteJsonString(buf, string(v.AllTime))
			buf.WriteString(`,"one_life_max":`)
			fflib.WriteJsonString(buf, string(v.OneLifeMax))
			if v.Day == nil {
				buf.WriteString(`,"day":null`)
			} else {
				buf.WriteString(`,"day":{ `)
				for key, value := range v.Day {
					fflib.WriteJsonString(buf, key)
					buf.WriteString(`:`)
					fflib.WriteJsonString(buf, string(value))
					buf.WriteByte(',')
				}
				buf.Rewind(1)
				buf.WriteByte('}')
			}
			if v.Month == nil {
				buf.WriteString(`,"Month":null`)
			} else {
				buf.WriteString(`,"Month":{ `)
				for key, value := range v.Month {
					fflib.WriteJsonString(buf, key)
					buf.WriteString(`:`)
					fflib.WriteJsonString(buf, string(value))
					buf.WriteByte(',')
				}
				buf.Rewind(1)
				buf.WriteByte('}')
			}
			if v.Week == nil {
				buf.WriteString(`,"Week":null`)
			} else {
				buf.WriteString(`,"Week":{ `)
				for key, value := range v.Week {
					fflib.WriteJsonString(buf, key)
					buf.WriteString(`:`)
					fflib.WriteJsonString(buf, string(value))
					buf.WriteByte(',')
				}
				buf.Rewind(1)
				buf.WriteByte('}')
			}
			buf.WriteByte('}')
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"weapon_stat":`)
	if mj.Stats.WeaponStat != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Stats.WeaponStat {
			if i != 0 {
				buf.WriteString(`,`)
			}
			/* Inline struct. type=struct { Name string "json:\"weapon_deaths\""; ItemID string "json:\"item_id\""; VehicleID string "json:\"vehicle_id\""; Value string "json:\"value\""; LastSave string "json:\"last_save\"" } kind=struct */
			buf.WriteString(`{ "weapon_deaths":`)
			fflib.WriteJsonString(buf, string(v.Name))
			buf.WriteString(`,"item_id":`)
			fflib.WriteJsonString(buf, string(v.ItemID))
			buf.WriteString(`,"vehicle_id":`)
			fflib.WriteJsonString(buf, string(v.VehicleID))
			buf.WriteString(`,"value":`)
			fflib.WriteJsonString(buf, string(v.Value))
			buf.WriteString(`,"last_save":`)
			fflib.WriteJsonString(buf, string(v.LastSave))
			buf.WriteByte('}')
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteByte('}')
	/* Inline struct. type=struct { Name struct { En string "json:\"en\""; De string "json:\"de\""; Es string "json:\"es\""; Fr string "json:\"fr\""; It string "json:\"it\""; Tr string "json:\"tr\"" } "json:\"name\""; ImageSetID string "json:\"image_set_id\""; ImageID string "json:\"image_id\""; ImagePath string "json:\"image_path\""; CodeTag string "json:\"code_tag\""; UserSelectable string "json:\"user_selectable\"" } kind=struct */
	/* Inline struct. type=struct { En string "json:\"en\""; De string "json:\"de\""; Es string "json:\"es\""; Fr string "json:\"fr\""; It string "json:\"it\""; Tr string "json:\"tr\"" } kind=struct */
	buf.WriteString(`,"faction":{ "name":{ "en":`)
	fflib.WriteJsonString(buf, string(mj.Faction.Name.En))
	buf.WriteString(`,"de":`)
	fflib.WriteJsonString(buf, string(mj.Faction.Name.De))
	buf.WriteString(`,"es":`)
	fflib.WriteJsonString(buf, string(mj.Faction.Name.Es))
	buf.WriteString(`,"fr":`)
	fflib.WriteJsonString(buf, string(mj.Faction.Name.Fr))
	buf.WriteString(`,"it":`)
	fflib.WriteJsonString(buf, string(mj.Faction.Name.It))
	buf.WriteString(`,"tr":`)
	fflib.WriteJsonString(buf, string(mj.Faction.Name.Tr))
	buf.WriteByte('}')
	buf.WriteString(`,"image_set_id":`)
	fflib.WriteJsonString(buf, string(mj.Faction.ImageSetID))
	buf.WriteString(`,"image_id":`)
	fflib.WriteJsonString(buf, string(mj.Faction.ImageID))
	buf.WriteString(`,"image_path":`)
	fflib.WriteJsonString(buf, string(mj.Faction.ImagePath))
	buf.WriteString(`,"code_tag":`)
	fflib.WriteJsonString(buf, string(mj.Faction.CodeTag))
	buf.WriteString(`,"user_selectable":`)
	fflib.WriteJsonString(buf, string(mj.Faction.UserSelectable))
	buf.WriteByte('}')
	buf.WriteString(`,"items":`)
	if mj.Items != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Items {
			if i != 0 {
				buf.WriteString(`,`)
			}
			/* Inline struct. type=struct { ID string "json:\"item_id\""; StackCount string "json:\"stack_count\"" } kind=struct */
			buf.WriteString(`{ "item_id":`)
			fflib.WriteJsonString(buf, string(v.ID))
			buf.WriteString(`,"stack_count":`)
			fflib.WriteJsonString(buf, string(v.StackCount))
			buf.WriteByte('}')
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"friends_list":`)
	if mj.FriendsList != nil {
		buf.WriteString(`[`)
		for i, v := range mj.FriendsList {
			if i != 0 {
				buf.WriteString(`,`)
			}
			/* Inline struct. type=struct { ID string "json:\"character_id\""; LastLoginTime string "json:\"last_login_time\""; Onlint string "json:\"online\"" } kind=struct */
			buf.WriteString(`{ "character_id":`)
			fflib.WriteJsonString(buf, string(v.ID))
			buf.WriteString(`,"last_login_time":`)
			fflib.WriteJsonString(buf, string(v.LastLoginTime))
			buf.WriteString(`,"online":`)
			fflib.WriteJsonString(buf, string(v.Onlint))
			buf.WriteByte('}')
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"world_id":`)
	fflib.WriteJsonString(buf, string(mj.World))
	buf.WriteString(`,"error":`)
	fflib.WriteJsonString(buf, string(mj.Error))
	buf.WriteString(`,"expires":`)

	{

		obj, err = mj.Expires.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)

	}
	buf.WriteString(`,"last-updated":`)

	{

		obj, err = mj.LastUpdated.MarshalJSON()
		if err != nil {
			return err
		}
		buf.Write(obj)

	}
	buf.WriteByte('}')
	return nil
}