Documentation ¶
Overview ¶
Package apache contains code for working with apache thrift indirectly
It acts as a bridge between generated code which relies on apache codec like:
Write(p thrift.TProtocol) error Read(p thrift.TProtocol) error
and kitex ecosystem.
Because we're deprecating apache thrift, all kitex ecosystem code will not rely on apache thrift except one pkg: `github.com/cloudwego/kitex/pkg/protocol/bthrift`. Why is the package chosen? All legacy generated code relies on it, and we may not be able to update the code in a brief timeframe. So the package is chosen to register helper methods to this package in order to use it without importing `github.com/apache/thrift`
Users must call `RegisterCheckTStruct`, `RegisterThriftRead` and `RegisterThriftWrite` for using `CheckTStruct`, `ThriftRead`, and `ThriftWrite`
see README.md of `bthrift` above for more details
Index ¶
- func CheckTStruct(v interface{}) error
- func RegisterCheckTStruct(fn func(v interface{}) error)
- func RegisterThriftRead(fn func(r bufiox.Reader, v interface{}) error)
- func RegisterThriftWrite(fn func(w bufiox.Writer, v interface{}) error)
- func ThriftRead(r bufiox.Reader, v interface{}) error
- func ThriftWrite(w bufiox.Writer, v interface{}) error
- type TTransport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterCheckTStruct ¶ added in v0.1.1
func RegisterCheckTStruct(fn func(v interface{}) error)
RegisterCheckTStruct accepts `thrift.TStruct check` func and save it for later use.
func RegisterThriftRead ¶ added in v0.1.1
RegisterThriftRead ...
func RegisterThriftWrite ¶ added in v0.1.1
RegisterThriftWrite ...
Types ¶
type TTransport ¶
type TTransport interface { io.ReadWriteCloser RemainingBytes() (num_bytes uint64) Flush(ctx context.Context) (err error) Open() error IsOpen() bool }
TTransport is identical with thrift.TTransport.
func NewBufferTransport ¶ added in v0.1.1
func NewBufferTransport(buf *bytes.Buffer) TTransport
NewBufferTransport extends bytes.Buffer to support TTransport
func NewDefaultTransport ¶ added in v0.1.1
func NewDefaultTransport(rw io.ReadWriter) TTransport
NewDefaultTransport converts io.ReadWriter to TTransport. Use NewBufferTransport if using *bytes.Buffer for better performance.