1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 package Example 4 5 import ( 6 flatbuffers "github.com/google/flatbuffers/go" 7 ) 8 9 type Stat struct { 10 _tab flatbuffers.Table 11 } 12 13 func GetRootAsStat(buf []byte, offset flatbuffers.UOffsetT) *Stat { 14 n := flatbuffers.GetUOffsetT(buf[offset:]) 15 x := &Stat{} 16 x.Init(buf, n+offset) 17 return x 18 } 19 20 func (rcv *Stat) Init(buf []byte, i flatbuffers.UOffsetT) { 21 rcv._tab.Bytes = buf 22 rcv._tab.Pos = i 23 } 24 25 func (rcv *Stat) Table() flatbuffers.Table { 26 return rcv._tab 27 } 28 29 func (rcv *Stat) Id() []byte { 30 o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) 31 if o != 0 { 32 return rcv._tab.ByteVector(o + rcv._tab.Pos) 33 } 34 return nil 35 } 36 37 func (rcv *Stat) Val() int64 { 38 o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) 39 if o != 0 { 40 return rcv._tab.GetInt64(o + rcv._tab.Pos) 41 } 42 return 0 43 } 44 45 func (rcv *Stat) MutateVal(n int64) bool { 46 return rcv._tab.MutateInt64Slot(6, n) 47 } 48 49 func (rcv *Stat) Count() uint16 { 50 o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) 51 if o != 0 { 52 return rcv._tab.GetUint16(o + rcv._tab.Pos) 53 } 54 return 0 55 } 56 57 func (rcv *Stat) MutateCount(n uint16) bool { 58 return rcv._tab.MutateUint16Slot(8, n) 59 } 60 61 func StatStart(builder *flatbuffers.Builder) { 62 builder.StartObject(3) 63 } 64 func StatAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) { 65 builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0) 66 } 67 func StatAddVal(builder *flatbuffers.Builder, val int64) { 68 builder.PrependInt64Slot(1, val, 0) 69 } 70 func StatAddCount(builder *flatbuffers.Builder, count uint16) { 71 builder.PrependUint16Slot(2, count, 0) 72 } 73 func StatEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { 74 return builder.EndObject() 75 } 76