当前位置: 首页>>代码示例>>Golang>>正文


Golang EncodingBuffer.WriteByte方法代码示例

本文整理汇总了Golang中github.com/pquerna/ffjson/fflib/v1.EncodingBuffer.WriteByte方法的典型用法代码示例。如果您正苦于以下问题:Golang EncodingBuffer.WriteByte方法的具体用法?Golang EncodingBuffer.WriteByte怎么用?Golang EncodingBuffer.WriteByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/pquerna/ffjson/fflib/v1.EncodingBuffer的用法示例。


在下文中一共展示了EncodingBuffer.WriteByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: MarshalJSONBuf

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
}
开发者ID:tugouer,项目名称:celeriac.v1,代码行数:60,代码来源:task_event_ffjson.go

示例2: MarshalJSONBuf

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
}
开发者ID:nagae-memooff,项目名称:surgemq,代码行数:27,代码来源:process_ffjson.go

示例3: MarshalJSONBuf

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
}
开发者ID:THUNDERGROOVE,项目名称:census,代码行数:35,代码来源:outfit_ffjson.go

示例4: MarshalJSONBuf

func (mj *Characters) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"character_list":`)
	if mj.Characters != nil {
		buf.WriteString(`[`)
		for i, v := range mj.Characters {
			if i != 0 {
				buf.WriteString(`,`)
			}

			{

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

			}
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteByte('}')
	return nil
}
开发者ID:THUNDERGROOVE,项目名称:census,代码行数:33,代码来源:character_ffjson.go

示例5: MarshalJSONBuf

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
}
开发者ID:strawmang,项目名称:strawmang,代码行数:27,代码来源:ffjson_chat.go

示例6: MarshalJSONBuf

func (mj *EventStream) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"Err":`)
	/* Falling back. type=chan error kind=chan */
	err = buf.Encode(mj.Err)
	if err != nil {
		return err
	}
	buf.WriteString(`,"Events":`)
	/* Falling back. type=chan census.Event kind=chan */
	err = buf.Encode(mj.Events)
	if err != nil {
		return err
	}
	buf.WriteString(`,"Closed":`)
	/* Falling back. type=chan struct {} kind=chan */
	err = buf.Encode(mj.Closed)
	if err != nil {
		return err
	}
	buf.WriteByte('}')
	return nil
}
开发者ID:THUNDERGROOVE,项目名称:census,代码行数:30,代码来源:event_stream_ffjson.go

示例7: MarshalJSONBuf

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
}
开发者ID:benjamin-rood,项目名称:gobr,代码行数:25,代码来源:json-types_ffjson.go

示例8: MarshalJSONBuf

func (mj *ProcessList) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"AnyTypes":`)
	if mj.AnyTypes != nil {
		buf.WriteString(`[`)
		for i, v := range mj.AnyTypes {
			if i != 0 {
				buf.WriteString(`,`)
			}

			{

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

			}
		}
		buf.WriteString(`]`)
	} else {
		buf.WriteString(`null`)
	}
	buf.WriteByte('}')
	return nil
}
开发者ID:chenbk85,项目名称:nephele,代码行数:33,代码来源:processplan_ffjson.go

示例9: MarshalJSONBuf

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
}
开发者ID:benjamin-rood,项目名称:abm-cp,代码行数:32,代码来源:render_ffjson.go

示例10: MarshalJSONBuf

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
}
开发者ID:xinhp,项目名称:libs,代码行数:35,代码来源:logger_ffjson.go

示例11: MarshalJSONBuf

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
}
开发者ID:wheelcomplex,项目名称:oui,代码行数:58,代码来源:entry_ffjson.go

示例12: MarshalJSONBuf

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
}
开发者ID:wheelcomplex,项目名称:geoip-service,代码行数:10,代码来源:reader_ffjson.go

示例13: MarshalJSONBuf

func (mj *StatsOutput) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"total":`)
	fflib.FormatBits2(buf, uint64(mj.Total), 10, false)
	buf.WriteString(`,"verified":`)
	fflib.FormatBits2(buf, uint64(mj.Verified), 10, false)
	buf.WriteByte('}')
	return nil
}
开发者ID:GeenPeil,项目名称:teken,代码行数:12,代码来源:outputtypes_ffjson.go

示例14: MarshalJSONBuf

func (mj *TCARD) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
	if mj == nil {
		buf.WriteString("null")
		return nil
	}
	var err error
	var obj []byte
	_ = obj
	_ = err
	buf.WriteString(`{"UNITLINK":`)
	fflib.WriteJsonString(buf, string(mj.UNITLINK))
	buf.WriteString(`,"CARDIDEX":`)
	fflib.FormatBits2(buf, uint64(mj.CARDIDEX), 10, mj.CARDIDEX < 0)
	buf.WriteString(`,"CARDBDID":`)
	fflib.FormatBits2(buf, uint64(mj.CARDBDID), 10, mj.CARDBDID < 0)
	buf.WriteString(`,"CARDKJND":`)
	fflib.FormatBits2(buf, uint64(mj.CARDKJND), 10, mj.CARDKJND < 0)
	buf.WriteString(`,"CARDKJQJ":`)
	fflib.FormatBits2(buf, uint64(mj.CARDKJQJ), 10, mj.CARDKJQJ < 0)
	buf.WriteString(`,"DEPTLINK":`)
	fflib.WriteJsonString(buf, string(mj.DEPTLINK))
	buf.WriteString(`,"CARDYWBZ":`)
	fflib.FormatBits2(buf, uint64(mj.CARDYWBZ), 10, mj.CARDYWBZ < 0)
	buf.WriteString(`,"SORTTYPE":`)
	fflib.WriteJsonString(buf, string(mj.SORTTYPE))
	buf.WriteString(`,"SORTNAME":`)
	fflib.WriteJsonString(buf, string(mj.SORTNAME))
	buf.WriteString(`,"SORTLINK":`)
	fflib.WriteJsonString(buf, string(mj.SORTLINK))
	buf.WriteString(`,"ZCLBTYPE":`)
	fflib.WriteJsonString(buf, string(mj.ZCLBTYPE))
	buf.WriteString(`,"ZCLBNAME":`)
	fflib.WriteJsonString(buf, string(mj.ZCLBNAME))
	buf.WriteString(`,"ZCLBLINK":`)
	fflib.WriteJsonString(buf, string(mj.ZCLBLINK))
	buf.WriteString(`,"CARDNAME":`)
	fflib.WriteJsonString(buf, string(mj.CARDNAME))
	buf.WriteString(`,"CARDZJNX":`)
	fflib.FormatBits2(buf, uint64(mj.CARDZJNX), 10, mj.CARDZJNX < 0)
	buf.WriteString(`,"CARDZJFF":`)
	fflib.WriteJsonString(buf, string(mj.CARDZJFF))
	buf.WriteString(`,"CARDZJZT":`)
	fflib.WriteJsonString(buf, string(mj.CARDZJZT))
	buf.WriteString(`,"CARDCODE":`)
	fflib.WriteJsonString(buf, string(mj.CARDCODE))
	buf.WriteString(`,"CARDJLDW":`)
	fflib.WriteJsonString(buf, string(mj.CARDJLDW))
	buf.WriteString(`,"CARDGGXH":`)
	fflib.WriteJsonString(buf, string(mj.CARDGGXH))
	buf.WriteByte('}')
	return nil
}
开发者ID:kazarus,项目名称:GoDemo,代码行数:52,代码来源:class_card_ffjson.go

示例15: MarshalJSONBuf

func (mj *Backend) 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.WriteByte('}')
	return nil
}
开发者ID:christian-blades-cb,项目名称:desoto,代码行数:14,代码来源:vulcand_ffjson.go


注:本文中的github.com/pquerna/ffjson/fflib/v1.EncodingBuffer.WriteByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。