diff --git a/src/idl_gen_go.cpp b/src/idl_gen_go.cpp index 867f4023221..ec69d3a8f51 100644 --- a/src/idl_gen_go.cpp +++ b/src/idl_gen_go.cpp @@ -356,8 +356,16 @@ class GoGenerator : public BaseGenerator { GenReceiver(struct_def, code_ptr); code += " " + MakeCamel(field.name); code += "() " + TypeName(field) + " "; - code += OffsetPrefix(field) + "\t\treturn "; + code += OffsetPrefix(field); + if (field.IsScalarOptional()) { + code += "\t\tv := "; + } else { + code += "\t\treturn "; + } code += CastToEnum(field.value.type, getter + "(o + rcv._tab.Pos)"); + if (field.IsScalarOptional()) { + code += "\n\t\treturn &v"; + } code += "\n\t}\n"; code += "\treturn " + GenConstant(field) + "\n"; code += "}\n\n"; @@ -571,12 +579,16 @@ class GoGenerator : public BaseGenerator { if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) { code += "flatbuffers.UOffsetT"; } else { - code += TypeName(field); + code += GenTypeGet(field.value.type); + } + code += ") {\n\t"; + code += "builder.Prepend"; + code += GenMethod(field); + if (field.IsScalarOptional()) { + code += "("; + } else { + code += "Slot(" + NumToString(offset) + ", "; } - code += ") {\n"; - code += "\tbuilder.Prepend"; - code += GenMethod(field) + "Slot("; - code += NumToString(offset) + ", "; if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) { code += "flatbuffers.UOffsetT"; code += "("; @@ -584,8 +596,14 @@ class GoGenerator : public BaseGenerator { } else { code += CastToBaseType(field.value.type, GoIdentity(field.name)); } - code += ", " + GenConstant(field); - code += ")\n}\n"; + if (field.IsScalarOptional()) { + code += ")\n"; + code += "\tbuilder.Slot(" + NumToString(offset); + } else { + code += ", " + GenConstant(field); + } + code += ")\n"; + code += "}\n"; } // Set the value of one of the members of a table's vector. @@ -669,7 +687,7 @@ class GoGenerator : public BaseGenerator { std::string setter = "rcv._tab.Mutate" + type; GenReceiver(struct_def, code_ptr); code += " Mutate" + MakeCamel(field.name); - code += "(n " + TypeName(field) + ") bool {\n\treturn " + setter; + code += "(n " + GenTypeGet(field.value.type) + ") bool {\n\treturn " + setter; code += "(rcv._tab.Pos+flatbuffers.UOffsetT("; code += NumToString(field.value.offset) + "), "; code += CastToBaseType(field.value.type, "n") + ")\n}\n\n"; @@ -683,7 +701,7 @@ class GoGenerator : public BaseGenerator { std::string setter = "rcv._tab.Mutate" + type + "Slot"; GenReceiver(struct_def, code_ptr); code += " Mutate" + MakeCamel(field.name); - code += "(n " + TypeName(field) + ") bool {\n\treturn "; + code += "(n " + GenTypeGet(field.value.type) + ") bool {\n\treturn "; code += setter + "(" + NumToString(field.value.offset) + ", "; code += CastToBaseType(field.value.type, "n") + ")\n"; code += "}\n\n"; @@ -801,8 +819,11 @@ class GoGenerator : public BaseGenerator { field.value.type.enum_def != nullptr && field.value.type.enum_def->is_union) continue; - code += "\t" + MakeCamel(field.name) + " " + - NativeType(field.value.type) + "\n"; + code += "\t" + MakeCamel(field.name) + " "; + if (field.IsScalarOptional()) { + code += "*"; + } + code += NativeType(field.value.type) + "\n"; } code += "}\n\n"; @@ -953,10 +974,18 @@ class GoGenerator : public BaseGenerator { std::string offset = MakeCamel(field.name, false) + "Offset"; if (IsScalar(field.value.type.base_type)) { + std::string prefix; + if (field.IsScalarOptional()) { + code += "\tif t." + MakeCamel(field.name) + " != nil {\n\t"; + prefix = "*"; + } if (field.value.type.enum_def == nullptr || !field.value.type.enum_def->is_union) { code += "\t" + struct_def.name + "Add" + MakeCamel(field.name) + - "(builder, t." + MakeCamel(field.name) + ")\n"; + "(builder, " + prefix + "t." + MakeCamel(field.name) + ")\n"; + } + if (field.IsScalarOptional()) { + code += "\t}\n"; } } else { if (field.value.type.base_type == BASE_TYPE_STRUCT && @@ -1192,7 +1221,11 @@ class GoGenerator : public BaseGenerator { } std::string TypeName(const FieldDef &field) { - return GenTypeGet(field.value.type); + std::string prefix; + if (field.IsScalarOptional()) { + prefix = "*"; + } + return prefix + GenTypeGet(field.value.type); } // If type is an enum, returns value with a cast to the enum type, otherwise @@ -1216,6 +1249,9 @@ class GoGenerator : public BaseGenerator { } std::string GenConstant(const FieldDef &field) { + if (field.IsScalarOptional()) { + return "nil"; + } switch (field.value.type.base_type) { case BASE_TYPE_BOOL: return field.value.constant == "0" ? "false" : "true"; diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index 47d01f0f086..fc9e095b2d0 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -2479,7 +2479,8 @@ bool Parser::SupportsOptionalScalars(const flatbuffers::IDLOptions &opts) { static FLATBUFFERS_CONSTEXPR unsigned long supported_langs = IDLOptions::kRust | IDLOptions::kSwift | IDLOptions::kLobster | IDLOptions::kKotlin | IDLOptions::kCpp | IDLOptions::kJava | - IDLOptions::kCSharp | IDLOptions::kTs | IDLOptions::kBinary; + IDLOptions::kCSharp | IDLOptions::kTs | IDLOptions::kBinary | + IDLOptions::kGo; unsigned long langs = opts.lang_to_generate; return (langs > 0 && langs < IDLOptions::kMAX) && !(langs & ~supported_langs); } diff --git a/tests/GoTest.sh b/tests/GoTest.sh index 8cbadcb56f6..9f7ad76fcef 100755 --- a/tests/GoTest.sh +++ b/tests/GoTest.sh @@ -19,8 +19,8 @@ test_dir="$(pwd)" go_path=${test_dir}/go_gen go_src=${go_path}/src -# Emit Go code for the example schema in the test dir: -../flatc -g --gen-object-api -I include_test monster_test.fbs +# Emit Go code for the example schemas in the test dir: +../flatc -g --gen-object-api -I include_test monster_test.fbs optional_scalars.fbs # Go requires a particular layout of files in order to link multiple packages. # Copy flatbuffer Go files to their own package directories to compile the @@ -29,6 +29,7 @@ mkdir -p ${go_src}/MyGame/Example mkdir -p ${go_src}/MyGame/Example2 mkdir -p ${go_src}/github.com/google/flatbuffers/go mkdir -p ${go_src}/flatbuffers_test +mkdir -p ${go_src}/optional_scalars cp -a MyGame/*.go ./go_gen/src/MyGame/ cp -a MyGame/Example/*.go ./go_gen/src/MyGame/Example/ @@ -38,6 +39,7 @@ cp -a MyGame/Example2/*.go ./go_gen/src/MyGame/Example2/ rm ./go_gen/src/MyGame/Example/*_grpc.go cp -a ../go/* ./go_gen/src/github.com/google/flatbuffers/go cp -a ./go_test.go ./go_gen/src/flatbuffers_test/ +cp -a optional_scalars/*.go ./go_gen/src/optional_scalars # Run tests with necessary flags. # Developers may wish to see more detail by appending the verbosity flag diff --git a/tests/go_test.go b/tests/go_test.go index 5d408f6de0f..11b3f0a32fb 100644 --- a/tests/go_test.go +++ b/tests/go_test.go @@ -17,8 +17,9 @@ package main import ( - mygame "MyGame" // refers to generated code - example "MyGame/Example" // refers to generated code + mygame "MyGame" // refers to generated code + example "MyGame/Example" // refers to generated code + optional_scalars "optional_scalars" // refers to generated code "bytes" "flag" @@ -133,6 +134,9 @@ func TestAll(t *testing.T) { // Check size-prefixed flatbuffers CheckSizePrefixedBuffer(t.Fatalf) + // Check that optional scalars work + CheckOptionalScalars(t.Fatalf) + // If the filename of the FlatBuffers file generated by the Java test // is given, check that Go code can read it, and that Go code // generates an identical buffer when used to create the example data: @@ -1861,6 +1865,296 @@ func CheckMutateMethods(fail func(string, ...interface{})) { } } +// CheckOptionalScalars verifies against the ScalarStuff schema. +func CheckOptionalScalars(fail func(string, ...interface{})) { + type testCase struct { + what string + result, expect interface{} + } + + makeDefaultTestCases := func(s *optional_scalars.ScalarStuff) []testCase { + return []testCase{ + {"justI8", s.JustI8(), int8(0)}, + {"maybeI8", s.MaybeI8(), (*int8)(nil)}, + {"defaultI8", s.DefaultI8(), int8(42)}, + {"justU8", s.JustU8(), byte(0)}, + {"maybeU8", s.MaybeU8(), (*byte)(nil)}, + {"defaultU8", s.DefaultU8(), byte(42)}, + {"justI16", s.JustI16(), int16(0)}, + {"maybeI16", s.MaybeI16(), (*int16)(nil)}, + {"defaultI16", s.DefaultI16(), int16(42)}, + {"justU16", s.JustU16(), uint16(0)}, + {"maybeU16", s.MaybeU16(), (*uint16)(nil)}, + {"defaultU16", s.DefaultU16(), uint16(42)}, + {"justI32", s.JustI32(), int32(0)}, + {"maybeI32", s.MaybeI32(), (*int32)(nil)}, + {"defaultI32", s.DefaultI32(), int32(42)}, + {"justU32", s.JustU32(), uint32(0)}, + {"maybeU32", s.MaybeU32(), (*uint32)(nil)}, + {"defaultU32", s.DefaultU32(), uint32(42)}, + {"justI64", s.JustI64(), int64(0)}, + {"maybeI64", s.MaybeI64(), (*int64)(nil)}, + {"defaultI64", s.DefaultI64(), int64(42)}, + {"justU64", s.JustU64(), uint64(0)}, + {"maybeU64", s.MaybeU64(), (*uint64)(nil)}, + {"defaultU64", s.DefaultU64(), uint64(42)}, + {"justF32", s.JustF32(), float32(0)}, + {"maybeF32", s.MaybeF32(), (*float32)(nil)}, + {"defaultF32", s.DefaultF32(), float32(42)}, + {"justF64", s.JustF64(), float64(0)}, + {"maybeF64", s.MaybeF64(), (*float64)(nil)}, + {"defaultF64", s.DefaultF64(), float64(42)}, + {"justBool", s.JustBool(), false}, + {"maybeBool", s.MaybeBool(), (*bool)(nil)}, + {"defaultBool", s.DefaultBool(), true}, + {"justEnum", s.JustEnum(), optional_scalars.OptionalByte(0)}, + {"maybeEnum", s.MaybeEnum(), (*optional_scalars.OptionalByte)(nil)}, + {"defaultEnum", s.DefaultEnum(), optional_scalars.OptionalByteOne}, + } + } + + makeAssignedTestCases := func(s *optional_scalars.ScalarStuff) []testCase { + return []testCase{ + {"justI8", s.JustI8(), int8(5)}, + {"maybeI8", s.MaybeI8(), int8(5)}, + {"defaultI8", s.DefaultI8(), int8(5)}, + {"justU8", s.JustU8(), byte(6)}, + {"maybeU8", s.MaybeU8(), byte(6)}, + {"defaultU8", s.DefaultU8(), byte(6)}, + {"justI16", s.JustI16(), int16(7)}, + {"maybeI16", s.MaybeI16(), int16(7)}, + {"defaultI16", s.DefaultI16(), int16(7)}, + {"justU16", s.JustU16(), uint16(8)}, + {"maybeU16", s.MaybeU16(), uint16(8)}, + {"defaultU16", s.DefaultU16(), uint16(8)}, + {"justI32", s.JustI32(), int32(9)}, + {"maybeI32", s.MaybeI32(), int32(9)}, + {"defaultI32", s.DefaultI32(), int32(9)}, + {"justU32", s.JustU32(), uint32(10)}, + {"maybeU32", s.MaybeU32(), uint32(10)}, + {"defaultU32", s.DefaultU32(), uint32(10)}, + {"justI64", s.JustI64(), int64(11)}, + {"maybeI64", s.MaybeI64(), int64(11)}, + {"defaultI64", s.DefaultI64(), int64(11)}, + {"justU64", s.JustU64(), uint64(12)}, + {"maybeU64", s.MaybeU64(), uint64(12)}, + {"defaultU64", s.DefaultU64(), uint64(12)}, + {"justF32", s.JustF32(), float32(13)}, + {"maybeF32", s.MaybeF32(), float32(13)}, + {"defaultF32", s.DefaultF32(), float32(13)}, + {"justF64", s.JustF64(), float64(14)}, + {"maybeF64", s.MaybeF64(), float64(14)}, + {"defaultF64", s.DefaultF64(), float64(14)}, + {"justBool", s.JustBool(), true}, + {"maybeBool", s.MaybeBool(), true}, + {"defaultBool", s.DefaultBool(), false}, + {"justEnum", s.JustEnum(), optional_scalars.OptionalByteTwo}, + {"maybeEnum", s.MaybeEnum(), optional_scalars.OptionalByteTwo}, + {"defaultEnum", s.DefaultEnum(), optional_scalars.OptionalByteTwo}, + } + } + + resolvePointer := func(v interface{}) interface{} { + switch v := v.(type) { + case *int8: + return *v + case *byte: + return *v + case *int16: + return *v + case *uint16: + return *v + case *int32: + return *v + case *uint32: + return *v + case *int64: + return *v + case *uint64: + return *v + case *float32: + return *v + case *float64: + return *v + case *bool: + return *v + case *optional_scalars.OptionalByte: + return *v + default: + return v + } + } + + buildAssignedTable := func(b *flatbuffers.Builder) *optional_scalars.ScalarStuff { + optional_scalars.ScalarStuffStart(b) + optional_scalars.ScalarStuffAddJustI8(b, int8(5)) + optional_scalars.ScalarStuffAddMaybeI8(b, int8(5)) + optional_scalars.ScalarStuffAddDefaultI8(b, int8(5)) + optional_scalars.ScalarStuffAddJustU8(b, byte(6)) + optional_scalars.ScalarStuffAddMaybeU8(b, byte(6)) + optional_scalars.ScalarStuffAddDefaultU8(b, byte(6)) + optional_scalars.ScalarStuffAddJustI16(b, int16(7)) + optional_scalars.ScalarStuffAddMaybeI16(b, int16(7)) + optional_scalars.ScalarStuffAddDefaultI16(b, int16(7)) + optional_scalars.ScalarStuffAddJustU16(b, uint16(8)) + optional_scalars.ScalarStuffAddMaybeU16(b, uint16(8)) + optional_scalars.ScalarStuffAddDefaultU16(b, uint16(8)) + optional_scalars.ScalarStuffAddJustI32(b, int32(9)) + optional_scalars.ScalarStuffAddMaybeI32(b, int32(9)) + optional_scalars.ScalarStuffAddDefaultI32(b, int32(9)) + optional_scalars.ScalarStuffAddJustU32(b, uint32(10)) + optional_scalars.ScalarStuffAddMaybeU32(b, uint32(10)) + optional_scalars.ScalarStuffAddDefaultU32(b, uint32(10)) + optional_scalars.ScalarStuffAddJustI64(b, int64(11)) + optional_scalars.ScalarStuffAddMaybeI64(b, int64(11)) + optional_scalars.ScalarStuffAddDefaultI64(b, int64(11)) + optional_scalars.ScalarStuffAddJustU64(b, uint64(12)) + optional_scalars.ScalarStuffAddMaybeU64(b, uint64(12)) + optional_scalars.ScalarStuffAddDefaultU64(b, uint64(12)) + optional_scalars.ScalarStuffAddJustF32(b, float32(13)) + optional_scalars.ScalarStuffAddMaybeF32(b, float32(13)) + optional_scalars.ScalarStuffAddDefaultF32(b, float32(13)) + optional_scalars.ScalarStuffAddJustF64(b, float64(14)) + optional_scalars.ScalarStuffAddMaybeF64(b, float64(14)) + optional_scalars.ScalarStuffAddDefaultF64(b, float64(14)) + optional_scalars.ScalarStuffAddJustBool(b, true) + optional_scalars.ScalarStuffAddMaybeBool(b, true) + optional_scalars.ScalarStuffAddDefaultBool(b, false) + optional_scalars.ScalarStuffAddJustEnum(b, optional_scalars.OptionalByteTwo) + optional_scalars.ScalarStuffAddMaybeEnum(b, optional_scalars.OptionalByteTwo) + optional_scalars.ScalarStuffAddDefaultEnum(b, optional_scalars.OptionalByteTwo) + b.Finish(optional_scalars.ScalarStuffEnd(b)) + return optional_scalars.GetRootAsScalarStuff(b.FinishedBytes(), 0) + } + + // test default values + + fbb := flatbuffers.NewBuilder(1) + optional_scalars.ScalarStuffStart(fbb) + fbb.Finish(optional_scalars.ScalarStuffEnd(fbb)) + ss := optional_scalars.GetRootAsScalarStuff(fbb.FinishedBytes(), 0) + for _, tc := range makeDefaultTestCases(ss) { + if tc.result != tc.expect { + fail(FailString("Default ScalarStuff: "+tc.what, tc.expect, tc.result)) + } + } + + // test assigned values + fbb.Reset() + ss = buildAssignedTable(fbb) + for _, tc := range makeAssignedTestCases(ss) { + if resolvePointer(tc.result) != tc.expect { + fail(FailString("Assigned ScalarStuff: "+tc.what, tc.expect, tc.result)) + } + } + + // test native object pack + fbb.Reset() + i8 := int8(5) + u8 := byte(6) + i16 := int16(7) + u16 := uint16(8) + i32 := int32(9) + u32 := uint32(10) + i64 := int64(11) + u64 := uint64(12) + f32 := float32(13) + f64 := float64(14) + b := true + enum := optional_scalars.OptionalByteTwo + obj := optional_scalars.ScalarStuffT{ + JustI8: 5, + MaybeI8: &i8, + DefaultI8: 5, + JustU8: 6, + MaybeU8: &u8, + DefaultU8: 6, + JustI16: 7, + MaybeI16: &i16, + DefaultI16: 7, + JustU16: 8, + MaybeU16: &u16, + DefaultU16: 8, + JustI32: 9, + MaybeI32: &i32, + DefaultI32: 9, + JustU32: 10, + MaybeU32: &u32, + DefaultU32: 10, + JustI64: 11, + MaybeI64: &i64, + DefaultI64: 11, + JustU64: 12, + MaybeU64: &u64, + DefaultU64: 12, + JustF32: 13, + MaybeF32: &f32, + DefaultF32: 13, + JustF64: 14, + MaybeF64: &f64, + DefaultF64: 14, + JustBool: true, + MaybeBool: &b, + DefaultBool: false, + JustEnum: optional_scalars.OptionalByteTwo, + MaybeEnum: &enum, + DefaultEnum: optional_scalars.OptionalByteTwo, + } + fbb.Finish(obj.Pack(fbb)) + ss = optional_scalars.GetRootAsScalarStuff(fbb.FinishedBytes(), 0) + for _, tc := range makeAssignedTestCases(ss) { + if resolvePointer(tc.result) != tc.expect { + fail(FailString("Native Object ScalarStuff: "+tc.what, tc.expect, tc.result)) + } + } + + // test native object unpack + fbb.Reset() + ss = buildAssignedTable(fbb) + ss.UnPackTo(&obj) + expectEq := func(what string, a, b interface{}) { + if resolvePointer(a) != b { + fail(FailString("Native Object Unpack ScalarStuff: "+what, b, a)) + } + } + expectEq("justI8", obj.JustI8, int8(5)) + expectEq("maybeI8", obj.MaybeI8, int8(5)) + expectEq("defaultI8", obj.DefaultI8, int8(5)) + expectEq("justU8", obj.JustU8, byte(6)) + expectEq("maybeU8", obj.MaybeU8, byte(6)) + expectEq("defaultU8", obj.DefaultU8, byte(6)) + expectEq("justI16", obj.JustI16, int16(7)) + expectEq("maybeI16", obj.MaybeI16, int16(7)) + expectEq("defaultI16", obj.DefaultI16, int16(7)) + expectEq("justU16", obj.JustU16, uint16(8)) + expectEq("maybeU16", obj.MaybeU16, uint16(8)) + expectEq("defaultU16", obj.DefaultU16, uint16(8)) + expectEq("justI32", obj.JustI32, int32(9)) + expectEq("maybeI32", obj.MaybeI32, int32(9)) + expectEq("defaultI32", obj.DefaultI32, int32(9)) + expectEq("justU32", obj.JustU32, uint32(10)) + expectEq("maybeU32", obj.MaybeU32, uint32(10)) + expectEq("defaultU32", obj.DefaultU32, uint32(10)) + expectEq("justI64", obj.JustI64, int64(11)) + expectEq("maybeI64", obj.MaybeI64, int64(11)) + expectEq("defaultI64", obj.DefaultI64, int64(11)) + expectEq("justU64", obj.JustU64, uint64(12)) + expectEq("maybeU64", obj.MaybeU64, uint64(12)) + expectEq("defaultU64", obj.DefaultU64, uint64(12)) + expectEq("justF32", obj.JustF32, float32(13)) + expectEq("maybeF32", obj.MaybeF32, float32(13)) + expectEq("defaultF32", obj.DefaultF32, float32(13)) + expectEq("justF64", obj.JustF64, float64(14)) + expectEq("maybeF64", obj.MaybeF64, float64(14)) + expectEq("defaultF64", obj.DefaultF64, float64(14)) + expectEq("justBool", obj.JustBool, true) + expectEq("maybeBool", obj.MaybeBool, true) + expectEq("defaultBool", obj.DefaultBool, false) + expectEq("justEnum", obj.JustEnum, optional_scalars.OptionalByteTwo) + expectEq("maybeEnum", obj.MaybeEnum, optional_scalars.OptionalByteTwo) + expectEq("defaultEnum", obj.DefaultEnum, optional_scalars.OptionalByteTwo) +} + // BenchmarkVtableDeduplication measures the speed of vtable deduplication // by creating prePop vtables, then populating b.N objects with a // different single vtable. diff --git a/tests/optional_scalars/OptionalByte.go b/tests/optional_scalars/OptionalByte.go new file mode 100644 index 00000000000..e1f5ac00d2a --- /dev/null +++ b/tests/optional_scalars/OptionalByte.go @@ -0,0 +1,32 @@ +// Code generated by the FlatBuffers compiler. DO NOT EDIT. + +package optional_scalars + +import "strconv" + +type OptionalByte int8 + +const ( + OptionalByteNone OptionalByte = 0 + OptionalByteOne OptionalByte = 1 + OptionalByteTwo OptionalByte = 2 +) + +var EnumNamesOptionalByte = map[OptionalByte]string{ + OptionalByteNone: "None", + OptionalByteOne: "One", + OptionalByteTwo: "Two", +} + +var EnumValuesOptionalByte = map[string]OptionalByte{ + "None": OptionalByteNone, + "One": OptionalByteOne, + "Two": OptionalByteTwo, +} + +func (v OptionalByte) String() string { + if s, ok := EnumNamesOptionalByte[v]; ok { + return s + } + return "OptionalByte(" + strconv.FormatInt(int64(v), 10) + ")" +} diff --git a/tests/optional_scalars/ScalarStuff.go b/tests/optional_scalars/ScalarStuff.go new file mode 100644 index 00000000000..2992f300284 --- /dev/null +++ b/tests/optional_scalars/ScalarStuff.go @@ -0,0 +1,756 @@ +// Code generated by the FlatBuffers compiler. DO NOT EDIT. + +package optional_scalars + +import ( + flatbuffers "github.com/google/flatbuffers/go" +) + +type ScalarStuffT struct { + JustI8 int8 + MaybeI8 *int8 + DefaultI8 int8 + JustU8 byte + MaybeU8 *byte + DefaultU8 byte + JustI16 int16 + MaybeI16 *int16 + DefaultI16 int16 + JustU16 uint16 + MaybeU16 *uint16 + DefaultU16 uint16 + JustI32 int32 + MaybeI32 *int32 + DefaultI32 int32 + JustU32 uint32 + MaybeU32 *uint32 + DefaultU32 uint32 + JustI64 int64 + MaybeI64 *int64 + DefaultI64 int64 + JustU64 uint64 + MaybeU64 *uint64 + DefaultU64 uint64 + JustF32 float32 + MaybeF32 *float32 + DefaultF32 float32 + JustF64 float64 + MaybeF64 *float64 + DefaultF64 float64 + JustBool bool + MaybeBool *bool + DefaultBool bool + JustEnum OptionalByte + MaybeEnum *OptionalByte + DefaultEnum OptionalByte +} + +func (t *ScalarStuffT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + if t == nil { return 0 } + ScalarStuffStart(builder) + ScalarStuffAddJustI8(builder, t.JustI8) + if t.MaybeI8 != nil { + ScalarStuffAddMaybeI8(builder, *t.MaybeI8) + } + ScalarStuffAddDefaultI8(builder, t.DefaultI8) + ScalarStuffAddJustU8(builder, t.JustU8) + if t.MaybeU8 != nil { + ScalarStuffAddMaybeU8(builder, *t.MaybeU8) + } + ScalarStuffAddDefaultU8(builder, t.DefaultU8) + ScalarStuffAddJustI16(builder, t.JustI16) + if t.MaybeI16 != nil { + ScalarStuffAddMaybeI16(builder, *t.MaybeI16) + } + ScalarStuffAddDefaultI16(builder, t.DefaultI16) + ScalarStuffAddJustU16(builder, t.JustU16) + if t.MaybeU16 != nil { + ScalarStuffAddMaybeU16(builder, *t.MaybeU16) + } + ScalarStuffAddDefaultU16(builder, t.DefaultU16) + ScalarStuffAddJustI32(builder, t.JustI32) + if t.MaybeI32 != nil { + ScalarStuffAddMaybeI32(builder, *t.MaybeI32) + } + ScalarStuffAddDefaultI32(builder, t.DefaultI32) + ScalarStuffAddJustU32(builder, t.JustU32) + if t.MaybeU32 != nil { + ScalarStuffAddMaybeU32(builder, *t.MaybeU32) + } + ScalarStuffAddDefaultU32(builder, t.DefaultU32) + ScalarStuffAddJustI64(builder, t.JustI64) + if t.MaybeI64 != nil { + ScalarStuffAddMaybeI64(builder, *t.MaybeI64) + } + ScalarStuffAddDefaultI64(builder, t.DefaultI64) + ScalarStuffAddJustU64(builder, t.JustU64) + if t.MaybeU64 != nil { + ScalarStuffAddMaybeU64(builder, *t.MaybeU64) + } + ScalarStuffAddDefaultU64(builder, t.DefaultU64) + ScalarStuffAddJustF32(builder, t.JustF32) + if t.MaybeF32 != nil { + ScalarStuffAddMaybeF32(builder, *t.MaybeF32) + } + ScalarStuffAddDefaultF32(builder, t.DefaultF32) + ScalarStuffAddJustF64(builder, t.JustF64) + if t.MaybeF64 != nil { + ScalarStuffAddMaybeF64(builder, *t.MaybeF64) + } + ScalarStuffAddDefaultF64(builder, t.DefaultF64) + ScalarStuffAddJustBool(builder, t.JustBool) + if t.MaybeBool != nil { + ScalarStuffAddMaybeBool(builder, *t.MaybeBool) + } + ScalarStuffAddDefaultBool(builder, t.DefaultBool) + ScalarStuffAddJustEnum(builder, t.JustEnum) + if t.MaybeEnum != nil { + ScalarStuffAddMaybeEnum(builder, *t.MaybeEnum) + } + ScalarStuffAddDefaultEnum(builder, t.DefaultEnum) + return ScalarStuffEnd(builder) +} + +func (rcv *ScalarStuff) UnPackTo(t *ScalarStuffT) { + t.JustI8 = rcv.JustI8() + t.MaybeI8 = rcv.MaybeI8() + t.DefaultI8 = rcv.DefaultI8() + t.JustU8 = rcv.JustU8() + t.MaybeU8 = rcv.MaybeU8() + t.DefaultU8 = rcv.DefaultU8() + t.JustI16 = rcv.JustI16() + t.MaybeI16 = rcv.MaybeI16() + t.DefaultI16 = rcv.DefaultI16() + t.JustU16 = rcv.JustU16() + t.MaybeU16 = rcv.MaybeU16() + t.DefaultU16 = rcv.DefaultU16() + t.JustI32 = rcv.JustI32() + t.MaybeI32 = rcv.MaybeI32() + t.DefaultI32 = rcv.DefaultI32() + t.JustU32 = rcv.JustU32() + t.MaybeU32 = rcv.MaybeU32() + t.DefaultU32 = rcv.DefaultU32() + t.JustI64 = rcv.JustI64() + t.MaybeI64 = rcv.MaybeI64() + t.DefaultI64 = rcv.DefaultI64() + t.JustU64 = rcv.JustU64() + t.MaybeU64 = rcv.MaybeU64() + t.DefaultU64 = rcv.DefaultU64() + t.JustF32 = rcv.JustF32() + t.MaybeF32 = rcv.MaybeF32() + t.DefaultF32 = rcv.DefaultF32() + t.JustF64 = rcv.JustF64() + t.MaybeF64 = rcv.MaybeF64() + t.DefaultF64 = rcv.DefaultF64() + t.JustBool = rcv.JustBool() + t.MaybeBool = rcv.MaybeBool() + t.DefaultBool = rcv.DefaultBool() + t.JustEnum = rcv.JustEnum() + t.MaybeEnum = rcv.MaybeEnum() + t.DefaultEnum = rcv.DefaultEnum() +} + +func (rcv *ScalarStuff) UnPack() *ScalarStuffT { + if rcv == nil { return nil } + t := &ScalarStuffT{} + rcv.UnPackTo(t) + return t +} + +type ScalarStuff struct { + _tab flatbuffers.Table +} + +func GetRootAsScalarStuff(buf []byte, offset flatbuffers.UOffsetT) *ScalarStuff { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &ScalarStuff{} + x.Init(buf, n+offset) + return x +} + +func GetSizePrefixedRootAsScalarStuff(buf []byte, offset flatbuffers.UOffsetT) *ScalarStuff { + n := flatbuffers.GetUOffsetT(buf[offset+flatbuffers.SizeUint32:]) + x := &ScalarStuff{} + x.Init(buf, n+offset+flatbuffers.SizeUint32) + return x +} + +func (rcv *ScalarStuff) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *ScalarStuff) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *ScalarStuff) JustI8() int8 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.GetInt8(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustI8(n int8) bool { + return rcv._tab.MutateInt8Slot(4, n) +} + +func (rcv *ScalarStuff) MaybeI8() *int8 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) + if o != 0 { + v := rcv._tab.GetInt8(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeI8(n int8) bool { + return rcv._tab.MutateInt8Slot(6, n) +} + +func (rcv *ScalarStuff) DefaultI8() int8 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) + if o != 0 { + return rcv._tab.GetInt8(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultI8(n int8) bool { + return rcv._tab.MutateInt8Slot(8, n) +} + +func (rcv *ScalarStuff) JustU8() byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) + if o != 0 { + return rcv._tab.GetByte(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustU8(n byte) bool { + return rcv._tab.MutateByteSlot(10, n) +} + +func (rcv *ScalarStuff) MaybeU8() *byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) + if o != 0 { + v := rcv._tab.GetByte(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeU8(n byte) bool { + return rcv._tab.MutateByteSlot(12, n) +} + +func (rcv *ScalarStuff) DefaultU8() byte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(14)) + if o != 0 { + return rcv._tab.GetByte(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultU8(n byte) bool { + return rcv._tab.MutateByteSlot(14, n) +} + +func (rcv *ScalarStuff) JustI16() int16 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(16)) + if o != 0 { + return rcv._tab.GetInt16(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustI16(n int16) bool { + return rcv._tab.MutateInt16Slot(16, n) +} + +func (rcv *ScalarStuff) MaybeI16() *int16 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(18)) + if o != 0 { + v := rcv._tab.GetInt16(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeI16(n int16) bool { + return rcv._tab.MutateInt16Slot(18, n) +} + +func (rcv *ScalarStuff) DefaultI16() int16 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(20)) + if o != 0 { + return rcv._tab.GetInt16(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultI16(n int16) bool { + return rcv._tab.MutateInt16Slot(20, n) +} + +func (rcv *ScalarStuff) JustU16() uint16 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(22)) + if o != 0 { + return rcv._tab.GetUint16(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustU16(n uint16) bool { + return rcv._tab.MutateUint16Slot(22, n) +} + +func (rcv *ScalarStuff) MaybeU16() *uint16 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(24)) + if o != 0 { + v := rcv._tab.GetUint16(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeU16(n uint16) bool { + return rcv._tab.MutateUint16Slot(24, n) +} + +func (rcv *ScalarStuff) DefaultU16() uint16 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(26)) + if o != 0 { + return rcv._tab.GetUint16(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultU16(n uint16) bool { + return rcv._tab.MutateUint16Slot(26, n) +} + +func (rcv *ScalarStuff) JustI32() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(28)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustI32(n int32) bool { + return rcv._tab.MutateInt32Slot(28, n) +} + +func (rcv *ScalarStuff) MaybeI32() *int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(30)) + if o != 0 { + v := rcv._tab.GetInt32(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeI32(n int32) bool { + return rcv._tab.MutateInt32Slot(30, n) +} + +func (rcv *ScalarStuff) DefaultI32() int32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(32)) + if o != 0 { + return rcv._tab.GetInt32(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultI32(n int32) bool { + return rcv._tab.MutateInt32Slot(32, n) +} + +func (rcv *ScalarStuff) JustU32() uint32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(34)) + if o != 0 { + return rcv._tab.GetUint32(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustU32(n uint32) bool { + return rcv._tab.MutateUint32Slot(34, n) +} + +func (rcv *ScalarStuff) MaybeU32() *uint32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(36)) + if o != 0 { + v := rcv._tab.GetUint32(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeU32(n uint32) bool { + return rcv._tab.MutateUint32Slot(36, n) +} + +func (rcv *ScalarStuff) DefaultU32() uint32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(38)) + if o != 0 { + return rcv._tab.GetUint32(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultU32(n uint32) bool { + return rcv._tab.MutateUint32Slot(38, n) +} + +func (rcv *ScalarStuff) JustI64() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(40)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustI64(n int64) bool { + return rcv._tab.MutateInt64Slot(40, n) +} + +func (rcv *ScalarStuff) MaybeI64() *int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(42)) + if o != 0 { + v := rcv._tab.GetInt64(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeI64(n int64) bool { + return rcv._tab.MutateInt64Slot(42, n) +} + +func (rcv *ScalarStuff) DefaultI64() int64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(44)) + if o != 0 { + return rcv._tab.GetInt64(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultI64(n int64) bool { + return rcv._tab.MutateInt64Slot(44, n) +} + +func (rcv *ScalarStuff) JustU64() uint64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(46)) + if o != 0 { + return rcv._tab.GetUint64(o + rcv._tab.Pos) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustU64(n uint64) bool { + return rcv._tab.MutateUint64Slot(46, n) +} + +func (rcv *ScalarStuff) MaybeU64() *uint64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(48)) + if o != 0 { + v := rcv._tab.GetUint64(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeU64(n uint64) bool { + return rcv._tab.MutateUint64Slot(48, n) +} + +func (rcv *ScalarStuff) DefaultU64() uint64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(50)) + if o != 0 { + return rcv._tab.GetUint64(o + rcv._tab.Pos) + } + return 42 +} + +func (rcv *ScalarStuff) MutateDefaultU64(n uint64) bool { + return rcv._tab.MutateUint64Slot(50, n) +} + +func (rcv *ScalarStuff) JustF32() float32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(52)) + if o != 0 { + return rcv._tab.GetFloat32(o + rcv._tab.Pos) + } + return 0.0 +} + +func (rcv *ScalarStuff) MutateJustF32(n float32) bool { + return rcv._tab.MutateFloat32Slot(52, n) +} + +func (rcv *ScalarStuff) MaybeF32() *float32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(54)) + if o != 0 { + v := rcv._tab.GetFloat32(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeF32(n float32) bool { + return rcv._tab.MutateFloat32Slot(54, n) +} + +func (rcv *ScalarStuff) DefaultF32() float32 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(56)) + if o != 0 { + return rcv._tab.GetFloat32(o + rcv._tab.Pos) + } + return 42.0 +} + +func (rcv *ScalarStuff) MutateDefaultF32(n float32) bool { + return rcv._tab.MutateFloat32Slot(56, n) +} + +func (rcv *ScalarStuff) JustF64() float64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(58)) + if o != 0 { + return rcv._tab.GetFloat64(o + rcv._tab.Pos) + } + return 0.0 +} + +func (rcv *ScalarStuff) MutateJustF64(n float64) bool { + return rcv._tab.MutateFloat64Slot(58, n) +} + +func (rcv *ScalarStuff) MaybeF64() *float64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(60)) + if o != 0 { + v := rcv._tab.GetFloat64(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeF64(n float64) bool { + return rcv._tab.MutateFloat64Slot(60, n) +} + +func (rcv *ScalarStuff) DefaultF64() float64 { + o := flatbuffers.UOffsetT(rcv._tab.Offset(62)) + if o != 0 { + return rcv._tab.GetFloat64(o + rcv._tab.Pos) + } + return 42.0 +} + +func (rcv *ScalarStuff) MutateDefaultF64(n float64) bool { + return rcv._tab.MutateFloat64Slot(62, n) +} + +func (rcv *ScalarStuff) JustBool() bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(64)) + if o != 0 { + return rcv._tab.GetBool(o + rcv._tab.Pos) + } + return false +} + +func (rcv *ScalarStuff) MutateJustBool(n bool) bool { + return rcv._tab.MutateBoolSlot(64, n) +} + +func (rcv *ScalarStuff) MaybeBool() *bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(66)) + if o != 0 { + v := rcv._tab.GetBool(o + rcv._tab.Pos) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeBool(n bool) bool { + return rcv._tab.MutateBoolSlot(66, n) +} + +func (rcv *ScalarStuff) DefaultBool() bool { + o := flatbuffers.UOffsetT(rcv._tab.Offset(68)) + if o != 0 { + return rcv._tab.GetBool(o + rcv._tab.Pos) + } + return true +} + +func (rcv *ScalarStuff) MutateDefaultBool(n bool) bool { + return rcv._tab.MutateBoolSlot(68, n) +} + +func (rcv *ScalarStuff) JustEnum() OptionalByte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(70)) + if o != 0 { + return OptionalByte(rcv._tab.GetInt8(o + rcv._tab.Pos)) + } + return 0 +} + +func (rcv *ScalarStuff) MutateJustEnum(n OptionalByte) bool { + return rcv._tab.MutateInt8Slot(70, int8(n)) +} + +func (rcv *ScalarStuff) MaybeEnum() *OptionalByte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(72)) + if o != 0 { + v := OptionalByte(rcv._tab.GetInt8(o + rcv._tab.Pos)) + return &v + } + return nil +} + +func (rcv *ScalarStuff) MutateMaybeEnum(n OptionalByte) bool { + return rcv._tab.MutateInt8Slot(72, int8(n)) +} + +func (rcv *ScalarStuff) DefaultEnum() OptionalByte { + o := flatbuffers.UOffsetT(rcv._tab.Offset(74)) + if o != 0 { + return OptionalByte(rcv._tab.GetInt8(o + rcv._tab.Pos)) + } + return 1 +} + +func (rcv *ScalarStuff) MutateDefaultEnum(n OptionalByte) bool { + return rcv._tab.MutateInt8Slot(74, int8(n)) +} + +func ScalarStuffStart(builder *flatbuffers.Builder) { + builder.StartObject(36) +} +func ScalarStuffAddJustI8(builder *flatbuffers.Builder, justI8 int8) { + builder.PrependInt8Slot(0, justI8, 0) +} +func ScalarStuffAddMaybeI8(builder *flatbuffers.Builder, maybeI8 int8) { + builder.PrependInt8(maybeI8) + builder.Slot(1) +} +func ScalarStuffAddDefaultI8(builder *flatbuffers.Builder, defaultI8 int8) { + builder.PrependInt8Slot(2, defaultI8, 42) +} +func ScalarStuffAddJustU8(builder *flatbuffers.Builder, justU8 byte) { + builder.PrependByteSlot(3, justU8, 0) +} +func ScalarStuffAddMaybeU8(builder *flatbuffers.Builder, maybeU8 byte) { + builder.PrependByte(maybeU8) + builder.Slot(4) +} +func ScalarStuffAddDefaultU8(builder *flatbuffers.Builder, defaultU8 byte) { + builder.PrependByteSlot(5, defaultU8, 42) +} +func ScalarStuffAddJustI16(builder *flatbuffers.Builder, justI16 int16) { + builder.PrependInt16Slot(6, justI16, 0) +} +func ScalarStuffAddMaybeI16(builder *flatbuffers.Builder, maybeI16 int16) { + builder.PrependInt16(maybeI16) + builder.Slot(7) +} +func ScalarStuffAddDefaultI16(builder *flatbuffers.Builder, defaultI16 int16) { + builder.PrependInt16Slot(8, defaultI16, 42) +} +func ScalarStuffAddJustU16(builder *flatbuffers.Builder, justU16 uint16) { + builder.PrependUint16Slot(9, justU16, 0) +} +func ScalarStuffAddMaybeU16(builder *flatbuffers.Builder, maybeU16 uint16) { + builder.PrependUint16(maybeU16) + builder.Slot(10) +} +func ScalarStuffAddDefaultU16(builder *flatbuffers.Builder, defaultU16 uint16) { + builder.PrependUint16Slot(11, defaultU16, 42) +} +func ScalarStuffAddJustI32(builder *flatbuffers.Builder, justI32 int32) { + builder.PrependInt32Slot(12, justI32, 0) +} +func ScalarStuffAddMaybeI32(builder *flatbuffers.Builder, maybeI32 int32) { + builder.PrependInt32(maybeI32) + builder.Slot(13) +} +func ScalarStuffAddDefaultI32(builder *flatbuffers.Builder, defaultI32 int32) { + builder.PrependInt32Slot(14, defaultI32, 42) +} +func ScalarStuffAddJustU32(builder *flatbuffers.Builder, justU32 uint32) { + builder.PrependUint32Slot(15, justU32, 0) +} +func ScalarStuffAddMaybeU32(builder *flatbuffers.Builder, maybeU32 uint32) { + builder.PrependUint32(maybeU32) + builder.Slot(16) +} +func ScalarStuffAddDefaultU32(builder *flatbuffers.Builder, defaultU32 uint32) { + builder.PrependUint32Slot(17, defaultU32, 42) +} +func ScalarStuffAddJustI64(builder *flatbuffers.Builder, justI64 int64) { + builder.PrependInt64Slot(18, justI64, 0) +} +func ScalarStuffAddMaybeI64(builder *flatbuffers.Builder, maybeI64 int64) { + builder.PrependInt64(maybeI64) + builder.Slot(19) +} +func ScalarStuffAddDefaultI64(builder *flatbuffers.Builder, defaultI64 int64) { + builder.PrependInt64Slot(20, defaultI64, 42) +} +func ScalarStuffAddJustU64(builder *flatbuffers.Builder, justU64 uint64) { + builder.PrependUint64Slot(21, justU64, 0) +} +func ScalarStuffAddMaybeU64(builder *flatbuffers.Builder, maybeU64 uint64) { + builder.PrependUint64(maybeU64) + builder.Slot(22) +} +func ScalarStuffAddDefaultU64(builder *flatbuffers.Builder, defaultU64 uint64) { + builder.PrependUint64Slot(23, defaultU64, 42) +} +func ScalarStuffAddJustF32(builder *flatbuffers.Builder, justF32 float32) { + builder.PrependFloat32Slot(24, justF32, 0.0) +} +func ScalarStuffAddMaybeF32(builder *flatbuffers.Builder, maybeF32 float32) { + builder.PrependFloat32(maybeF32) + builder.Slot(25) +} +func ScalarStuffAddDefaultF32(builder *flatbuffers.Builder, defaultF32 float32) { + builder.PrependFloat32Slot(26, defaultF32, 42.0) +} +func ScalarStuffAddJustF64(builder *flatbuffers.Builder, justF64 float64) { + builder.PrependFloat64Slot(27, justF64, 0.0) +} +func ScalarStuffAddMaybeF64(builder *flatbuffers.Builder, maybeF64 float64) { + builder.PrependFloat64(maybeF64) + builder.Slot(28) +} +func ScalarStuffAddDefaultF64(builder *flatbuffers.Builder, defaultF64 float64) { + builder.PrependFloat64Slot(29, defaultF64, 42.0) +} +func ScalarStuffAddJustBool(builder *flatbuffers.Builder, justBool bool) { + builder.PrependBoolSlot(30, justBool, false) +} +func ScalarStuffAddMaybeBool(builder *flatbuffers.Builder, maybeBool bool) { + builder.PrependBool(maybeBool) + builder.Slot(31) +} +func ScalarStuffAddDefaultBool(builder *flatbuffers.Builder, defaultBool bool) { + builder.PrependBoolSlot(32, defaultBool, true) +} +func ScalarStuffAddJustEnum(builder *flatbuffers.Builder, justEnum OptionalByte) { + builder.PrependInt8Slot(33, int8(justEnum), 0) +} +func ScalarStuffAddMaybeEnum(builder *flatbuffers.Builder, maybeEnum OptionalByte) { + builder.PrependInt8(int8(maybeEnum)) + builder.Slot(34) +} +func ScalarStuffAddDefaultEnum(builder *flatbuffers.Builder, defaultEnum OptionalByte) { + builder.PrependInt8Slot(35, int8(defaultEnum), 1) +} +func ScalarStuffEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +}