コード例 #1
0
ファイル: ffjson_chat.go プロジェクト: strawmang/strawmang
func (mj *User) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"name":`)
	fflib.WriteJsonString(buf, string(mj.Name))
	buf.WriteString(`,"color":`)
	fflib.WriteJsonString(buf, string(mj.Color))
	if mj.LoggedIn {
		buf.WriteString(`,"logged-in":true`)
	} else {
		buf.WriteString(`,"logged-in":false`)
	}
	/* Falling back. type=map[int]chat.voteOption kind=map */
	buf.WriteString(`,"voteMask":`)
	err = buf.Encode(mj.Votes)
	if err != nil {
		return err
	}
	buf.WriteByte('}')
	return nil
}
コード例 #2
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
}
コード例 #3
0
func (mj *MtBroadCastMessage) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"topics":`)
	if mj.Clients != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Clients {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.WriteJsonString(buf, string(v))
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"payload":`)
	fflib.WriteJsonString(buf, string(mj.Payload))
	buf.WriteByte('}')
	return nil
}
コード例 #4
0
ファイル: errors_ffjson.go プロジェクト: raiqub/oauth
func (mj *Error) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{ "error":`)
	fflib.WriteJsonString(buf, string(mj.Code))
	buf.WriteByte(',')
	if len(mj.Description) != 0 {
		buf.WriteString(`"error_description":`)
		fflib.WriteJsonString(buf, string(mj.Description))
		buf.WriteByte(',')
	}
	if len(mj.URI) != 0 {
		buf.WriteString(`"error_uri":`)
		fflib.WriteJsonString(buf, string(mj.URI))
		buf.WriteByte(',')
	}
	buf.Rewind(1)
	buf.WriteByte('}')
	return nil
}
コード例 #5
0
func (mj *Event) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Payload":`)

	{

		err = mj.Payload.MarshalJSONBuf(buf)
		if err != nil {
			return err
		}

	}
	buf.WriteString(`,"service":`)
	fflib.WriteJsonString(buf, string(mj.Service))
	buf.WriteString(`,"type":`)
	fflib.WriteJsonString(buf, string(mj.Type))
	buf.WriteByte('}')
	return nil
}
コード例 #6
0
ファイル: event_ffjson.go プロジェクト: postfix/bangarang
func (mj *Event) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"host":`)
	fflib.WriteJsonString(buf, string(mj.Host))
	buf.WriteString(`,"service":`)
	fflib.WriteJsonString(buf, string(mj.Service))
	buf.WriteString(`,"sub_service":`)
	fflib.WriteJsonString(buf, string(mj.SubService))
	buf.WriteString(`,"metric":`)
	fflib.AppendFloat(buf, float64(mj.Metric), 'g', -1, 64)
	if mj.Tags == nil {
		buf.WriteString(`,"tags":null`)
	} else {
		buf.WriteString(`,"tags":{ `)
		for key, value := range mj.Tags {
			fflib.WriteJsonString(buf, key)
			buf.WriteString(`:`)
			fflib.WriteJsonString(buf, string(value))
			buf.WriteByte(',')
		}
		buf.Rewind(1)
		buf.WriteByte('}')
	}
	buf.WriteByte('}')
	return nil
}
コード例 #7
0
ファイル: logger_ffjson.go プロジェクト: xinhp/libs
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
}
コード例 #8
0
ファイル: entry_ffjson.go プロジェクト: wheelcomplex/oui
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
}
コード例 #9
0
func (mj *TaskEvent) 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(`,"hostname":`)
	fflib.WriteJsonString(buf, string(mj.Hostname))
	buf.WriteString(`,"timestamp":`)
	fflib.AppendFloat(buf, float64(mj.Timestamp), 'g', -1, 32)
	buf.WriteString(`,"pid":`)
	fflib.FormatBits2(buf, uint64(mj.PID), 10, mj.PID < 0)
	buf.WriteString(`,"clock":`)
	fflib.FormatBits2(buf, uint64(mj.Clock), 10, mj.Clock < 0)
	buf.WriteString(`,"utcoffset":`)
	fflib.FormatBits2(buf, uint64(mj.UTCOffset), 10, mj.UTCOffset < 0)
	buf.WriteString(`,"uuid":`)
	fflib.WriteJsonString(buf, string(mj.UUID))
	buf.WriteString(`,"name":`)
	fflib.WriteJsonString(buf, string(mj.Name))
	buf.WriteString(`,"args":`)
	fflib.WriteJsonString(buf, string(mj.Args))
	buf.WriteString(`,"kwargs":`)
	fflib.WriteJsonString(buf, string(mj.Kwargs))
	buf.WriteString(`,"result":`)
	fflib.WriteJsonString(buf, string(mj.Result))
	buf.WriteString(`,"runtime":`)
	fflib.AppendFloat(buf, float64(mj.Runtime), 'g', -1, 32)
	buf.WriteString(`,"retries":`)
	fflib.FormatBits2(buf, uint64(mj.Retries), 10, mj.Retries < 0)
	buf.WriteString(`,"eta":`)
	fflib.FormatBits2(buf, uint64(mj.ETA), 10, mj.ETA < 0)
	buf.WriteString(`,"exception":`)
	fflib.WriteJsonString(buf, string(mj.Exception))
	buf.WriteString(`,"traceback":`)
	fflib.WriteJsonString(buf, string(mj.Traceback))
	if mj.Terminated {
		buf.WriteString(`,"terminated":true`)
	} else {
		buf.WriteString(`,"terminated":false`)
	}
	buf.WriteString(`,"signum":`)
	/* Interface types must use runtime reflection. type=interface {} kind=interface */
	err = buf.Encode(mj.Signum)
	if err != nil {
		return err
	}
	if mj.Expired {
		buf.WriteString(`,"expired":true`)
	} else {
		buf.WriteString(`,"expired":false`)
	}
	buf.WriteByte('}')
	return nil
}
コード例 #10
0
func (mj *EventSent) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"service":`)
	fflib.WriteJsonString(buf, string(mj.Service))
	buf.WriteString(`,"action":`)
	fflib.WriteJsonString(buf, string(mj.Action))
	buf.WriteString(`,"worlds":`)
	if mj.Worlds != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Worlds {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.WriteJsonString(buf, string(v))
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"characters":`)
	if mj.Characters != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Characters {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.WriteJsonString(buf, string(v))
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"eventNames":`)
	if mj.EventNames != nil {
		buf.WriteString(`[`)
		for i, v := range mj.EventNames {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.WriteJsonString(buf, string(v))
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteByte('}')
	return nil
}
コード例 #11
0
ファイル: outfit_ffjson.go プロジェクト: THUNDERGROOVE/census
func (mj *Outfit) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"outfit_id":`)
	fflib.WriteJsonString(buf, string(mj.ID))
	buf.WriteString(`,"name":`)
	fflib.WriteJsonString(buf, string(mj.Name))
	buf.WriteString(`,"name_lower":`)
	fflib.WriteJsonString(buf, string(mj.NameLower))
	buf.WriteString(`,"alias":`)
	fflib.WriteJsonString(buf, string(mj.Alias))
	buf.WriteString(`,"alias_lower":`)
	fflib.WriteJsonString(buf, string(mj.AliasLower))
	buf.WriteString(`,"time_created":`)
	fflib.WriteJsonString(buf, string(mj.TimeCreated))
	buf.WriteString(`,"leader_character_id":`)
	fflib.WriteJsonString(buf, string(mj.LeaderCharID))
	buf.WriteString(`,"member_count":`)
	fflib.WriteJsonString(buf, string(mj.MemberCount))
	buf.WriteByte('}')
	return nil
}
コード例 #12
0
func (mj *WorkerEvent) 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(`,"hostname":`)
	fflib.WriteJsonString(buf, string(mj.Hostname))
	buf.WriteString(`,"timestamp":`)
	fflib.AppendFloat(buf, float64(mj.Timestamp), 'g', -1, 32)
	buf.WriteString(`,"pid":`)
	fflib.FormatBits2(buf, uint64(mj.PID), 10, mj.PID < 0)
	buf.WriteString(`,"clock":`)
	fflib.FormatBits2(buf, uint64(mj.Clock), 10, mj.Clock < 0)
	buf.WriteString(`,"utcoffset":`)
	fflib.FormatBits2(buf, uint64(mj.UTCOffset), 10, mj.UTCOffset < 0)
	buf.WriteString(`,"sw_sys":`)
	fflib.WriteJsonString(buf, string(mj.SWSystem))
	buf.WriteString(`,"sw_ver":`)
	fflib.WriteJsonString(buf, string(mj.SWVersion))
	buf.WriteString(`,"loadavg":`)
	if mj.LoadAverage != nil {
		buf.WriteString(`[`)
		for i, v := range mj.LoadAverage {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.AppendFloat(buf, float64(v), 'g', -1, 32)
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"freq":`)
	fflib.AppendFloat(buf, float64(mj.Freq), 'g', -1, 32)
	buf.WriteString(`,"sw_ident":`)
	fflib.WriteJsonString(buf, string(mj.SWIdentity))
	buf.WriteString(`,"processed":`)
	fflib.FormatBits2(buf, uint64(mj.Processed), 10, mj.Processed < 0)
	buf.WriteString(`,"active":`)
	fflib.FormatBits2(buf, uint64(mj.Active), 10, mj.Active < 0)
	buf.WriteByte('}')
	return nil
}
コード例 #13
0
ファイル: incident_ffjson.go プロジェクト: postfix/bangarang
func (mj *Incident) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"event":`)
	if mj.EventName != nil {
		buf.WriteString(`"`)
		{
			enc := base64.NewEncoder(base64.StdEncoding, buf)
			enc.Write(reflect.Indirect(reflect.ValueOf(mj.EventName)).Bytes())
			enc.Close()
		}
		buf.WriteString(`"`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"time":`)
	fflib.FormatBits2(buf, uint64(mj.Time), 10, mj.Time < 0)
	buf.WriteString(`,"id":`)
	fflib.FormatBits2(buf, uint64(mj.Id), 10, mj.Id < 0)
	if mj.Active {
		buf.WriteString(`,"active":true`)
	} else {
		buf.WriteString(`,"active":false`)
	}
	buf.WriteString(`,"escalation":`)
	fflib.WriteJsonString(buf, string(mj.Escalation))
	buf.WriteString(`,"description":`)
	fflib.WriteJsonString(buf, string(mj.Description))
	buf.WriteString(`,"policy":`)
	fflib.WriteJsonString(buf, string(mj.Policy))
	buf.WriteString(`,"status":`)
	fflib.FormatBits2(buf, uint64(mj.Status), 10, mj.Status < 0)
	buf.WriteString(`,"host":`)
	fflib.WriteJsonString(buf, string(mj.Host))
	buf.WriteString(`,"service":`)
	fflib.WriteJsonString(buf, string(mj.Service))
	buf.WriteString(`,"sub_service":`)
	fflib.WriteJsonString(buf, string(mj.SubService))
	buf.WriteString(`,"metric":`)
	fflib.AppendFloat(buf, float64(mj.Metric), 'g', -1, 64)
	if mj.Tags == nil {
		buf.WriteString(`,"tags":null`)
	} else {
		buf.WriteString(`,"tags":{ `)
		for key, value := range mj.Tags {
			fflib.WriteJsonString(buf, key)
			buf.WriteString(`:`)
			fflib.WriteJsonString(buf, string(value))
			buf.WriteByte(',')
		}
		buf.Rewind(1)
		buf.WriteByte('}')
	}
	buf.WriteByte('}')
	return nil
}
コード例 #14
0
ファイル: logoinfo_ffjson.go プロジェクト: chenbk85/nephele
func (mj *LogoInfo) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Path":`)
	fflib.WriteJsonString(buf, string(mj.Path))
	buf.WriteString(`,"Name":`)
	fflib.WriteJsonString(buf, string(mj.Name))
	buf.WriteByte('}')
	return nil
}
コード例 #15
0
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
}
コード例 #16
0
ファイル: render_ffjson.go プロジェクト: benjamin-rood/abm-cp
func (mj *AgentRender) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"agent-type":`)
	fflib.WriteJsonString(buf, string(mj.Type))
	buf.WriteString(`,"position":`)

	{

		err = mj.Pos2D.MarshalJSONBuf(buf)
		if err != nil {
			return err
		}

	}
	buf.WriteString(`,"heading":`)
	fflib.AppendFloat(buf, float64(mj.Heading), 'g', -1, 64)
	/* Struct fall back. type=colour.RGB256 kind=struct */
	buf.WriteString(`,"colour":`)
	err = buf.Encode(&mj.Colour)
	if err != nil {
		return err
	}
	buf.WriteByte('}')
	return nil
}
コード例 #17
0
func (mj *ResponseCountry) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{ `)
	if mj.Data != nil {
		if true {
			buf.WriteString(`"Data":`)

			{
				err = mj.Data.MarshalJSONBuf(buf)
				if err != nil {
					return err
				}
			}

			buf.WriteByte(',')
		}
	}
	if len(mj.Error) != 0 {
		buf.WriteString(`"Error":`)
		fflib.WriteJsonString(buf, string(mj.Error))
		buf.WriteByte(',')
	}
	buf.Rewind(1)
	buf.WriteByte('}')
	return nil
}
コード例 #18
0
ファイル: outfit_ffjson.go プロジェクト: THUNDERGROOVE/census
func (mj *Outfits) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"outfit_list":`)
	if mj.Outfits != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Outfits {
			if i != 0 {
				buf.WriteString(`,`)
			}

			{

				err = v.MarshalJSONBuf(buf)
				if err != nil {
					return err
				}

			}
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteString(`,"error":`)
	fflib.WriteJsonString(buf, string(mj.Error))
	buf.WriteByte('}')
	return nil
}
コード例 #19
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
}
コード例 #20
0
func (mj *Collection) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Count":`)
	fflib.FormatBits2(buf, uint64(mj.Count), 10, mj.Count < 0)
	if mj.Dynamic {
		buf.WriteString(`,"Dynamic":true`)
	} else {
		buf.WriteString(`,"Dynamic":false`)
	}
	if mj.UnknownCount {
		buf.WriteString(`,"UnknownCount":true`)
	} else {
		buf.WriteString(`,"UnknownCount":false`)
	}
	if mj.Hidden {
		buf.WriteString(`,"Hidden":true`)
	} else {
		buf.WriteString(`,"Hidden":false`)
	}
	buf.WriteString(`,"Name":`)
	fflib.WriteJsonString(buf, string(mj.Name))
	buf.WriteString(`,"ResolveList":`)
	if mj.ResolveList != nil {
		buf.WriteString(`[`)
		for i, v := range mj.ResolveList {
			if i != 0 {
				buf.WriteString(`,`)
			}
			fflib.WriteJsonString(buf, string(v))
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteByte('}')
	return nil
}
コード例 #21
0
func (mj *Domain) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Domain":`)
	fflib.WriteJsonString(buf, string(mj.Domain))
	buf.WriteByte('}')
	return nil
}
コード例 #22
0
func (mj *Postal) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Code":`)
	fflib.WriteJsonString(buf, string(mj.Code))
	buf.WriteByte('}')
	return nil
}
コード例 #23
0
func (mj *BroIPFields) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"id.orig_h":`)
	fflib.WriteJsonString(buf, string(mj.ID_orig_h))
	buf.WriteString(`,"id.resp_h":`)
	fflib.WriteJsonString(buf, string(mj.ID_resp_h))
	buf.WriteString(`,"src":`)
	fflib.WriteJsonString(buf, string(mj.Src))
	buf.WriteString(`,"dst":`)
	fflib.WriteJsonString(buf, string(mj.Dst))
	buf.WriteByte('}')
	return nil
}
コード例 #24
0
func (mj *EventPayload) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"event_name":`)
	fflib.WriteJsonString(buf, string(mj.EventName))
	buf.WriteString(`,"timestamp":`)
	fflib.WriteJsonString(buf, string(mj.Time))
	buf.WriteString(`,"character_id":`)
	fflib.WriteJsonString(buf, string(mj.CharacterID))
	buf.WriteString(`,"world_id":`)
	fflib.WriteJsonString(buf, string(mj.WorldID))
	buf.WriteByte('}')
	return nil
}
コード例 #25
0
ファイル: state_ffjson.go プロジェクト: jimmidyson/runc
func (mj *State) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"version":`)
	fflib.WriteJsonString(buf, string(mj.Version))
	buf.WriteString(`,"id":`)
	fflib.WriteJsonString(buf, string(mj.ID))
	buf.WriteString(`,"pid":`)
	fflib.FormatBits2(buf, uint64(mj.Pid), 10, mj.Pid < 0)
	buf.WriteString(`,"bundlePath":`)
	fflib.WriteJsonString(buf, string(mj.BundlePath))
	buf.WriteByte('}')
	return nil
}
コード例 #26
0
ファイル: fingerprint_ffjson.go プロジェクト: schollz/find
func (mj *Fingerprint) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"group":`)
	fflib.WriteJsonString(buf, string(mj.Group))
	buf.WriteString(`,"username":`)
	fflib.WriteJsonString(buf, string(mj.Username))
	buf.WriteString(`,"location":`)
	fflib.WriteJsonString(buf, string(mj.Location))
	buf.WriteString(`,"timestamp":`)
	fflib.FormatBits2(buf, uint64(mj.Timestamp), 10, mj.Timestamp < 0)
	buf.WriteString(`,"wifi-fingerprint":`)
	if mj.WifiFingerprint != nil {
		buf.WriteString(`[`)
		for i, v := range mj.WifiFingerprint {
			if i != 0 {
				buf.WriteString(`,`)
			}

			{

				err = v.MarshalJSONBuf(buf)
				if err != nil {
					return err
				}

			}
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteByte('}')
	return nil
}
コード例 #27
0
ファイル: ffjson_chat.go プロジェクト: strawmang/strawmang
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
}
コード例 #28
0
func (mj *ServiceDefinition) 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(`,"container_port":`)
	fflib.FormatBits2(buf, uint64(mj.ContainerPort), 10, mj.ContainerPort < 0)
	if mj.NamePattern != nil {
		buf.WriteString(`,"name_pattern":`)
		fflib.WriteJsonString(buf, string(*mj.NamePattern))
	} else {
		buf.WriteString(`,"name_pattern":null`)
	}
	buf.WriteByte('}')
	return nil
}
コード例 #29
0
ファイル: jsonerror_ffjson.go プロジェクト: raiqub/web
func (mj *JSONError) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{ `)
	if mj.Status != 0 {
		buf.WriteString(`"status":`)
		fflib.FormatBits2(buf, uint64(mj.Status), 10, mj.Status < 0)
		buf.WriteByte(',')
	}
	if len(mj.Code) != 0 {
		buf.WriteString(`"code":`)
		fflib.WriteJsonString(buf, string(mj.Code))
		buf.WriteByte(',')
	}
	if len(mj.Type) != 0 {
		buf.WriteString(`"type":`)
		fflib.WriteJsonString(buf, string(mj.Type))
		buf.WriteByte(',')
	}
	if len(mj.Message) != 0 {
		buf.WriteString(`"message":`)
		fflib.WriteJsonString(buf, string(mj.Message))
		buf.WriteByte(',')
	}
	if len(mj.MoreInfo) != 0 {
		buf.WriteString(`"moreInfo":`)
		fflib.WriteJsonString(buf, string(mj.MoreInfo))
		buf.WriteByte(',')
	}
	buf.Rewind(1)
	buf.WriteByte('}')
	return nil
}
コード例 #30
0
ファイル: models_ffjson.go プロジェクト: raiqub/oauth
func (mj *TokenResponse) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{ "access_token":`)
	fflib.WriteJsonString(buf, string(mj.AccessToken))
	buf.WriteString(`,"token_type":`)
	fflib.WriteJsonString(buf, string(mj.TokenType))
	buf.WriteByte(',')
	if mj.ExpiresIn != 0 {
		buf.WriteString(`"expires_in":`)
		fflib.FormatBits2(buf, uint64(mj.ExpiresIn), 10, mj.ExpiresIn < 0)
		buf.WriteByte(',')
	}
	if len(mj.RefreshToken) != 0 {
		buf.WriteString(`"refresh_token":`)
		fflib.WriteJsonString(buf, string(mj.RefreshToken))
		buf.WriteByte(',')
	}
	if len(mj.Scope) != 0 {
		buf.WriteString(`"scope":`)
		fflib.WriteJsonString(buf, string(mj.Scope))
		buf.WriteByte(',')
	}
	if len(mj.State) != 0 {
		buf.WriteString(`"state":`)
		fflib.WriteJsonString(buf, string(mj.State))
		buf.WriteByte(',')
	}
	buf.Rewind(1)
	buf.WriteByte('}')
	return nil
}