mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
* add unit tests for support struct as key * make changes to parser and add helper function to generate comparator for struct * implement * add more unit tests * format * just a test * test done * rerun generator * restore build file * address comment * format * rebase * rebase * add more unit tests * rerun generator * address some comments * address comment * update * format * address comment Co-authored-by: Wen Sun <sunwen@google.com> Co-authored-by: Derek Bailey <derekbailey@google.com>
50 lines
624 B
Plaintext
50 lines
624 B
Plaintext
namespace keyfield.sample;
|
|
|
|
struct Baz {
|
|
a: [uint8:4] (key); // A fixed-sized array of uint8 as a Key
|
|
b: uint8 ;
|
|
}
|
|
|
|
struct Bar {
|
|
a: [float:3] (key); // A fixed-sized array of float as a Key
|
|
b: uint8;
|
|
}
|
|
|
|
struct Color {
|
|
rgb: [float:3] (key);
|
|
tag: uint8;
|
|
}
|
|
|
|
struct Apple {
|
|
tag: uint8;
|
|
color: Color(key);
|
|
}
|
|
|
|
struct Fruit {
|
|
a: Apple (key);
|
|
b: uint8;
|
|
}
|
|
|
|
struct Rice {
|
|
origin: [uint8:3];
|
|
quantity: uint32;
|
|
}
|
|
|
|
struct Grain {
|
|
a: [Rice:3] (key);
|
|
tag: uint8;
|
|
}
|
|
|
|
table FooTable {
|
|
a: int;
|
|
b: int;
|
|
c: string (key);
|
|
d: [Baz];
|
|
e: [Bar];
|
|
f: [Apple];
|
|
g: [Fruit];
|
|
h: [Grain];
|
|
}
|
|
root_type FooTable;
|
|
|