mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-15 00:38:52 +00:00
Go - Use Go bool type for bool fields (#4962)
* Use Go bool type for bool fields, and store non-default bool field to test data
This commit is contained in:
@@ -241,16 +241,16 @@ func (rcv *Monster) Testempty(obj *Stat) *Stat {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcv *Monster) Testbool() byte {
|
||||
func (rcv *Monster) Testbool() bool {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(34))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetByte(o + rcv._tab.Pos)
|
||||
return rcv._tab.GetBool(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
return false
|
||||
}
|
||||
|
||||
func (rcv *Monster) MutateTestbool(n byte) bool {
|
||||
return rcv._tab.MutateByteSlot(34, n)
|
||||
func (rcv *Monster) MutateTestbool(n bool) bool {
|
||||
return rcv._tab.MutateBoolSlot(34, n)
|
||||
}
|
||||
|
||||
func (rcv *Monster) Testhashs32Fnv1() int32 {
|
||||
@@ -349,13 +349,13 @@ func (rcv *Monster) MutateTesthashu64Fnv1a(n uint64) bool {
|
||||
return rcv._tab.MutateUint64Slot(50, n)
|
||||
}
|
||||
|
||||
func (rcv *Monster) Testarrayofbools(j int) byte {
|
||||
func (rcv *Monster) Testarrayofbools(j int) bool {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(52))
|
||||
if o != 0 {
|
||||
a := rcv._tab.Vector(o)
|
||||
return rcv._tab.GetByte(a + flatbuffers.UOffsetT(j*1))
|
||||
return rcv._tab.GetBool(a + flatbuffers.UOffsetT(j*1))
|
||||
}
|
||||
return 0
|
||||
return false
|
||||
}
|
||||
|
||||
func (rcv *Monster) TestarrayofboolsLength() int {
|
||||
@@ -716,8 +716,8 @@ func MonsterStartTestnestedflatbufferVector(builder *flatbuffers.Builder, numEle
|
||||
func MonsterAddTestempty(builder *flatbuffers.Builder, testempty flatbuffers.UOffsetT) {
|
||||
builder.PrependUOffsetTSlot(14, flatbuffers.UOffsetT(testempty), 0)
|
||||
}
|
||||
func MonsterAddTestbool(builder *flatbuffers.Builder, testbool byte) {
|
||||
builder.PrependByteSlot(15, testbool, 0)
|
||||
func MonsterAddTestbool(builder *flatbuffers.Builder, testbool bool) {
|
||||
builder.PrependBoolSlot(15, testbool, false)
|
||||
}
|
||||
func MonsterAddTesthashs32Fnv1(builder *flatbuffers.Builder, testhashs32Fnv1 int32) {
|
||||
builder.PrependInt32Slot(16, testhashs32Fnv1, 0)
|
||||
|
||||
Reference in New Issue
Block a user