• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang go.Builder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/google/flatbuffers/go.Builder的典型用法代码示例。如果您正苦于以下问题:Golang Builder类的具体用法?Golang Builder怎么用?Golang Builder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: CreateTest

func CreateTest(builder *flatbuffers.Builder, a int16, b int8) flatbuffers.UOffsetT {
	builder.Prep(2, 4)
	builder.Pad(1)
	builder.PrependInt8(b)
	builder.PrependInt16(a)
	return builder.Offset()
}
开发者ID:google,项目名称:flatbuffers,代码行数:7,代码来源:Test.go


示例2: CreateVec3

func CreateVec3(builder *flatbuffers.Builder, x float32, y float32, z float32) flatbuffers.UOffsetT {
	builder.Prep(4, 12)
	builder.PrependFloat32(z)
	builder.PrependFloat32(y)
	builder.PrependFloat32(x)
	return builder.Offset()
}
开发者ID:jforns,项目名称:flatbuffers-monster-sample,代码行数:7,代码来源:Vec3.go


示例3: serializeUsingFlatBuffers

func serializeUsingFlatBuffers(builder *flatbuffers.Builder, a *A) []byte {
	builder.Reset()

	name := builder.CreateString(a.Name)
	phone := builder.CreateString(a.Phone)

	FlatBufferAStart(builder)
	FlatBufferAAddName(builder, name)
	FlatBufferAAddPhone(builder, phone)
	FlatBufferAAddBirthDay(builder, a.BirthDay.Unix())
	FlatBufferAAddSiblings(builder, int32(a.Siblings))
	var spouse byte
	if a.Spouse {
		spouse = byte(1)
	}
	FlatBufferAAddSpouse(builder, spouse)
	FlatBufferAAddMoney(builder, a.Money)
	builder.Finish(FlatBufferAEnd(builder))
	return builder.Bytes[builder.Head():]
}
开发者ID:junchaowu,项目名称:go_serialization_benchmarks,代码行数:20,代码来源:serialization_benchmarks_test.go


示例4: MakeMonster

func MakeMonster(builder *flatbuffers.Builder) []byte {
	builder.Reset()

	name := []byte("One Sample Monster")
	name_position := builder.CreateByteString(name)

	example.MonsterStart(builder)
	example.MonsterAddPos(builder, example.CreateVec3(builder, 1.0, 2.0, 3.0))
	example.MonsterAddHp(builder, 80)
	example.MonsterAddName(builder, name_position)

	monster_position := example.MonsterEnd(builder)

	builder.Finish(monster_position)

	return builder.Bytes[builder.Head():]
}
开发者ID:jforns,项目名称:flatbuffers-monster-sample,代码行数:17,代码来源:monster.go


示例5: MakeUser

// main.go part 2 of 4
func MakeUser(b *flatbuffers.Builder, name []byte, id uint64) []byte {
	// re-use the already-allocated Builder:
	b.Reset()

	// create the name object and get its offset:
	name_position := b.CreateByteString(name)

	// write the User object:
	users.UserStart(b)
	users.UserAddName(b, name_position)
	users.UserAddId(b, id)
	user_position := users.UserEnd(b)

	// finish the write operations by our User the root object:
	b.Finish(user_position)

	// return the byte slice containing encoded data:
	return b.Bytes[b.Head():]
}
开发者ID:rw,项目名称:go-flatbuffers-example,代码行数:20,代码来源:main.go


示例6: StatAddCount

func StatAddCount(builder *flatbuffers.Builder, count uint16)   { builder.PrependUint16Slot(2, count, 0) }
开发者ID:mystal,项目名称:flatbuffers,代码行数:1,代码来源:Stat.go


示例7: StatAddId

func StatAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0)
}
开发者ID:mystal,项目名称:flatbuffers,代码行数:3,代码来源:Stat.go


示例8: MonsterEnd

func MonsterEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() }
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:1,代码来源:Monster.go


示例9: MonsterStartTestnestedflatbufferVector

func MonsterStartTestnestedflatbufferVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(1, numElems, 1)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例10: MonsterAddEnemy

func MonsterAddEnemy(builder *flatbuffers.Builder, enemy flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(12, flatbuffers.UOffsetT(enemy), 0)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例11: MonsterAddTestarrayoftables

func MonsterAddTestarrayoftables(builder *flatbuffers.Builder, testarrayoftables flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(11, flatbuffers.UOffsetT(testarrayoftables), 0)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例12: MonsterAddMana

func MonsterAddMana(builder *flatbuffers.Builder, mana int16) { builder.PrependInt16Slot(1, mana, 150) }
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:1,代码来源:Monster.go


示例13: MonsterAddPos

func MonsterAddPos(builder *flatbuffers.Builder, pos flatbuffers.UOffsetT) {
	builder.PrependStructSlot(0, flatbuffers.UOffsetT(pos), 0)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例14: MonsterStart

func MonsterStart(builder *flatbuffers.Builder) { builder.StartObject(15) }
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:1,代码来源:Monster.go


示例15: PostingEnd

func PostingEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { return builder.EndObject() }
开发者ID:cayleydb,项目名称:dgraph,代码行数:1,代码来源:Posting.go


示例16: MonsterStartTest4Vector

func MonsterStartTest4Vector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 2)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例17: MonsterAddTestarrayofstring

func MonsterAddTestarrayofstring(builder *flatbuffers.Builder, testarrayofstring flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(10, flatbuffers.UOffsetT(testarrayofstring), 0)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例18: MonsterAddHp

func MonsterAddHp(builder *flatbuffers.Builder, hp int16)     { builder.PrependInt16Slot(2, hp, 100) }
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:1,代码来源:Monster.go


示例19: MonsterStartTestarrayoftablesVector

func MonsterStartTestarrayoftablesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go


示例20: MonsterAddName

func MonsterAddName(builder *flatbuffers.Builder, name flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(name), 0)
}
开发者ID:BlueBrain,项目名称:flatbuffers,代码行数:3,代码来源:Monster.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang repository.Repo类代码示例发布时间:2022-05-23
下一篇:
Golang go.UOffsetT函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap