Ejemplo n.º 1
0
func (mj *TheCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	var scratch fflib.FormatBitsScratch
	_ = scratch
	_ = obj
	_ = err
	buf.WriteString(`{"GeoNameID":`)
	fflib.FormatBits(&scratch, buf, uint64(mj.GeoNameID), 10, false)
	buf.WriteString(`,"IsoCode":`)
	fflib.WriteJsonString(buf, string(mj.IsoCode))
	if mj.Names == nil {
		buf.WriteString(`,"Names":null`)
	} else {
		buf.WriteString(`,"Names":{ `)
		for key, value := range mj.Names {
			fflib.WriteJsonString(buf, key)
			buf.WriteString(`:`)
			fflib.WriteJsonString(buf, string(value))
			buf.WriteByte(',')
		}
		buf.Rewind(1)
		buf.WriteByte('}')
	}
	buf.WriteByte('}')
	return nil
}
Ejemplo n.º 2
0
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
}
Ejemplo n.º 3
0
func (mj *ISP) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	var scratch fflib.FormatBitsScratch
	_ = scratch
	_ = obj
	_ = err
	buf.WriteString(`{"AutonomousSystemNumber":`)
	fflib.FormatBits(&scratch, buf, uint64(mj.AutonomousSystemNumber), 10, false)
	buf.WriteString(`,"AutonomousSystemOrganization":`)
	fflib.WriteJsonString(buf, string(mj.AutonomousSystemOrganization))
	buf.WriteString(`,"ISP":`)
	fflib.WriteJsonString(buf, string(mj.ISP))
	buf.WriteString(`,"Organization":`)
	fflib.WriteJsonString(buf, string(mj.Organization))
	buf.WriteByte('}')
	return nil
}