Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 1 | // Code generated by the FlatBuffers compiler. DO NOT EDIT. |
| 2 | |
| 3 | package Example |
| 4 | |
| 5 | import ( |
| 6 | flatbuffers "github.com/google/flatbuffers/go" |
| 7 | ) |
| 8 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 9 | type StatT struct { |
Austin Schuh | 2dd86a9 | 2022-09-14 21:19:23 -0700 | [diff] [blame] | 10 | Id string `json:"id"` |
| 11 | Val int64 `json:"val"` |
| 12 | Count uint16 `json:"count"` |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | func (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 | |
| 25 | func (rcv *Stat) UnPackTo(t *StatT) { |
| 26 | t.Id = string(rcv.Id()) |
| 27 | t.Val = rcv.Val() |
| 28 | t.Count = rcv.Count() |
| 29 | } |
| 30 | |
| 31 | func (rcv *Stat) UnPack() *StatT { |
| 32 | if rcv == nil { return nil } |
| 33 | t := &StatT{} |
| 34 | rcv.UnPackTo(t) |
| 35 | return t |
| 36 | } |
| 37 | |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 38 | type Stat struct { |
| 39 | _tab flatbuffers.Table |
| 40 | } |
| 41 | |
| 42 | func 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 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame] | 49 | func GetSizePrefixedRootAsStat(buf []byte, offset flatbuffers.UOffsetT) *Stat { |
| 50 | n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:]) |
| 51 | x := &Stat{} |
| 52 | x.Init(buf, n+offset+flatbuffers.SizeUint32) |
| 53 | return x |
| 54 | } |
| 55 | |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 56 | func (rcv *Stat) Init(buf []byte, i flatbuffers.UOffsetT) { |
| 57 | rcv._tab.Bytes = buf |
| 58 | rcv._tab.Pos = i |
| 59 | } |
| 60 | |
| 61 | func (rcv *Stat) Table() flatbuffers.Table { |
| 62 | return rcv._tab |
| 63 | } |
| 64 | |
| 65 | func (rcv *Stat) Id() []byte { |
| 66 | o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) |
| 67 | if o != 0 { |
| 68 | return rcv._tab.ByteVector(o + rcv._tab.Pos) |
| 69 | } |
| 70 | return nil |
| 71 | } |
| 72 | |
| 73 | func (rcv *Stat) Val() int64 { |
| 74 | o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) |
| 75 | if o != 0 { |
| 76 | return rcv._tab.GetInt64(o + rcv._tab.Pos) |
| 77 | } |
| 78 | return 0 |
| 79 | } |
| 80 | |
| 81 | func (rcv *Stat) MutateVal(n int64) bool { |
| 82 | return rcv._tab.MutateInt64Slot(6, n) |
| 83 | } |
| 84 | |
| 85 | func (rcv *Stat) Count() uint16 { |
| 86 | o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) |
| 87 | if o != 0 { |
| 88 | return rcv._tab.GetUint16(o + rcv._tab.Pos) |
| 89 | } |
| 90 | return 0 |
| 91 | } |
| 92 | |
| 93 | func (rcv *Stat) MutateCount(n uint16) bool { |
| 94 | return rcv._tab.MutateUint16Slot(8, n) |
| 95 | } |
| 96 | |
| 97 | func StatStart(builder *flatbuffers.Builder) { |
| 98 | builder.StartObject(3) |
| 99 | } |
| 100 | func StatAddId(builder *flatbuffers.Builder, id flatbuffers.UOffsetT) { |
| 101 | builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(id), 0) |
| 102 | } |
| 103 | func StatAddVal(builder *flatbuffers.Builder, val int64) { |
| 104 | builder.PrependInt64Slot(1, val, 0) |
| 105 | } |
| 106 | func StatAddCount(builder *flatbuffers.Builder, count uint16) { |
| 107 | builder.PrependUint16Slot(2, count, 0) |
| 108 | } |
| 109 | func StatEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { |
| 110 | return builder.EndObject() |
| 111 | } |