Source File
grpc.go
Belonging Package
github.com/google/flatbuffers/go
package flatbuffers// Codec implements gRPC-go Codec which is used to encode and decode messages.var Codec = "flatbuffers"// FlatbuffersCodec defines the interface gRPC uses to encode and decode messages. Note// that implementations of this interface must be thread safe; a Codec's// methods can be called from concurrent goroutines.type FlatbuffersCodec struct{}// Marshal returns the wire format of v.func (FlatbuffersCodec) ( interface{}) ([]byte, error) {return .(*Builder).FinishedBytes(), nil}// Unmarshal parses the wire format into v.func (FlatbuffersCodec) ( []byte, interface{}) error {.(flatbuffersInit).Init(, GetUOffsetT())return nil}// String old gRPC Codec interface funcfunc (FlatbuffersCodec) () string {return Codec}// Name returns the name of the Codec implementation. The returned string// will be used as part of content type in transmission. The result must be// static; the result cannot change between calls.//// add Name() for ForceCodec interfacefunc (FlatbuffersCodec) () string {return Codec}type flatbuffersInit interface {Init(data []byte, i UOffsetT)}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |