• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Code generated by the FlatBuffers compiler. DO NOT EDIT.
2
3package Example
4
5import (
6	flatbuffers "github.com/google/flatbuffers/go"
7)
8
9type StatT struct {
10	Id string
11	Val int64
12	Count uint16
13}
14
15func (t *StatT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
16	if t == nil { return 0 }
17	idOffset := builder.CreateString(t.Id)
18	StatStart(builder)
19	StatAddId(builder, idOffset)
20	StatAddVal(builder, t.Val)
21	StatAddCount(builder, t.Count)
22	return StatEnd(builder)
23}
24
25func (rcv *Stat) UnPackTo(t *StatT) {
26	t.Id = string(rcv.Id())
27	t.Val = rcv.Val()
28	t.Count = rcv.Count()
29}
30
31func (rcv *Stat) UnPack() *StatT {
32	if rcv == nil { return nil }
33	t := &StatT{}
34	rcv.UnPackTo(t)
35	return t
36}
37
38type Stat struct {
39	_tab flatbuffers.Table
40}
41
42func GetRootAsStat(buf []byte, offset flatbuffers.UOffsetT) *Stat {
43	n := flatbuffers.GetUOffsetT(buf[offset:])
44	x := &Stat{}
45	x.Init(buf, n+offset)
46	return x
47}
48
49func (rcv *Stat) Init(buf []byte, i flatbuffers.UOffsetT) {
50	rcv._tab.Bytes = buf
51	rcv._tab.Pos = i
52}
53
54func (rcv *Stat) Table() flatbuffers.Table {
55	return rcv._tab
56}
57
58func (rcv *Stat) Id() []byte {
59	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
60	if o != 0 {
61		return rcv._tab.ByteVector(o + rcv._tab.Pos)
62	}
63	return nil
64}
65
66func (rcv *Stat) Val() int64 {
67	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
68	if o != 0 {
69		return rcv._tab.GetInt64(o + rcv._tab.Pos)
70	}
71	return 0
72}
73
74func (rcv *Stat) MutateVal(n int64) bool {
75	return rcv._tab.MutateInt64Slot(6, n)
76}
77
78func (rcv *Stat) Count() uint16 {
79	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
80	if o != 0 {
81		return rcv._tab.GetUint16(o + rcv._tab.Pos)
82	}
83	return 0
84}
85
86func (rcv *Stat) MutateCount(n uint16) bool {
87	return rcv._tab.MutateUint16Slot(8, n)
88}
89
90func StatStart(builder *flatbuffers.Builder) {
91	builder.StartObject(3)
92}
93func StatAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) {
94	builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0)
95}
96func StatAddVal(builder *flatbuffers.Builder, val int64) {
97	builder.PrependInt64Slot(1, val, 0)
98}
99func StatAddCount(builder *flatbuffers.Builder, count uint16) {
100	builder.PrependUint16Slot(2, count, 0)
101}
102func StatEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
103	return builder.EndObject()
104}
105