mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-18 01:26:31 +00:00
Add a generic way to deserialize a flatbuffer in Go.
Similar to what protobufs does with its `Message` interface, introduce here such interface and create a generic `GetRootAs` method to deserialize a flatbuffer.
This commit is contained in:
@@ -15,6 +15,10 @@ func (rcv *Test) Init(buf []byte, i flatbuffers.UOffsetT) {
|
||||
rcv._tab.Pos = i
|
||||
}
|
||||
|
||||
func (rcv *Test) Table() flatbuffers.Table {
|
||||
return rcv._tab.Table
|
||||
}
|
||||
|
||||
func (rcv *Test) A() int16 {
|
||||
return rcv._tab.GetInt16(rcv._tab.Pos + flatbuffers.UOffsetT(0))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user