thrift

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2024 License: Apache-2.0 Imports: 36 Imported by: 2

Documentation

Overview

Package thrift provides thrift idl parser and codec for generic call

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

Parse descriptor from parser.Thrift

func SetDefaultParseMode added in v0.1.0

func SetDefaultParseMode(m ParseMode)

SetDefaultParseMode sets the default parse mode.

Types

type Base

type Base = base.Base

Base ... Deprecated: use github.com/cloudwego/gopkg/protocol/thrift/base

func NewBase

func NewBase() *Base

NewBase ... Deprecated: use github.com/cloudwego/gopkg/protocol/thrift/base

type BaseResp

type BaseResp = base.BaseResp

BaseResp ... Deprecated: use github.com/cloudwego/gopkg/protocol/thrift/base

func NewBaseResp

func NewBaseResp() *BaseResp

NewBaseResp ... Deprecated: use github.com/cloudwego/gopkg/protocol/thrift/base

type HTTPPbReaderWriter added in v0.11.0

type HTTPPbReaderWriter struct {
	*ReadHTTPPbResponse
	*WriteHTTPPbRequest
}

func NewHTTPPbReaderWriter added in v0.11.0

func NewHTTPPbReaderWriter(svc *descriptor.ServiceDescriptor, pbsvc proto.ServiceDescriptor) *HTTPPbReaderWriter

type HTTPReaderWriter added in v0.11.0

type HTTPReaderWriter struct {
	*ReadHTTPResponse
	*WriteHTTPRequest
}

func NewHTTPReaderWriter added in v0.11.0

func NewHTTPReaderWriter(svc *descriptor.ServiceDescriptor) *HTTPReaderWriter

type JSONReaderWriter added in v0.11.0

type JSONReaderWriter struct {
	*ReadJSON
	*WriteJSON
}

func NewJsonReaderWriter added in v0.11.0

func NewJsonReaderWriter(svc *descriptor.ServiceDescriptor) *JSONReaderWriter

type MessageReader

type MessageReader interface {
	Read(ctx context.Context, method string, isClient bool, dataLen int, in bufiox.Reader) (interface{}, error)
}

MessageReader read from thrift.TProtocol with method

type MessageWriter

type MessageWriter interface {
	Write(ctx context.Context, out bufiox.Writer, msg interface{}, method string, isClient bool, requestBase *base.Base) error
}

MessageWriter write to thrift.TProtocol

type MsgType added in v0.7.0

type MsgType int

type ParseMode added in v0.1.0

type ParseMode int

ParseMode .

const (
	// LastServiceOnly forces the parser to parse only the last service definition.
	LastServiceOnly ParseMode = iota

	// FirstServiceOnly forces the parser to parse only the first service definition.
	FirstServiceOnly

	// CombineServices forces the parser to combine methods of all service definitions.
	// Note that method names of the service definitions can not be duplicate.
	CombineServices
)

func DefaultParseMode added in v0.1.0

func DefaultParseMode() ParseMode

DefaultParseMode returns the default parse mode.

type ReadHTTPPbResponse added in v0.4.0

type ReadHTTPPbResponse struct {
	// contains filtered or unexported fields
}

ReadHTTPPbResponse implement of MessageReaderWithMethod

func NewReadHTTPPbResponse added in v0.4.0

func NewReadHTTPPbResponse(svc *descriptor.ServiceDescriptor, pbSvc proto.ServiceDescriptor) *ReadHTTPPbResponse

NewReadHTTPPbResponse ... Base64 encoding for binary is enabled by default.

func (*ReadHTTPPbResponse) Read added in v0.4.0

func (r *ReadHTTPPbResponse) Read(ctx context.Context, method string, isClient bool, dataLen int, in bufiox.Reader) (interface{}, error)

Read ...

type ReadHTTPResponse

type ReadHTTPResponse struct {
	// contains filtered or unexported fields
}

ReadHTTPResponse implement of MessageReaderWithMethod

func NewReadHTTPResponse

func NewReadHTTPResponse(svc *descriptor.ServiceDescriptor) *ReadHTTPResponse

NewReadHTTPResponse ... Base64 encoding for binary is enabled by default.

func (*ReadHTTPResponse) Read

func (r *ReadHTTPResponse) Read(ctx context.Context, method string, isClient bool, dataLen int, in bufiox.Reader) (interface{}, error)

Read ...

func (*ReadHTTPResponse) SetBase64Binary added in v0.1.3

func (r *ReadHTTPResponse) SetBase64Binary(enable bool)

SetBase64Binary enable/disable Base64 encoding for binary. Note that this method is not concurrent-safe.

func (*ReadHTTPResponse) SetDynamicGo added in v0.7.0

func (r *ReadHTTPResponse) SetDynamicGo(convOpts *conv.Options)

SetDynamicGo ...

func (*ReadHTTPResponse) SetUseRawBodyForHTTPResp added in v0.7.0

func (r *ReadHTTPResponse) SetUseRawBodyForHTTPResp(useRawBodyForHTTPResp bool)

SetUseRawBodyForHTTPResp ...

type ReadJSON added in v0.0.5

type ReadJSON struct {
	// contains filtered or unexported fields
}

ReadJSON implement of MessageReaderWithMethod

func NewReadJSON added in v0.0.5

func NewReadJSON(svc *descriptor.ServiceDescriptor) *ReadJSON

NewReadJSON build ReadJSON according to ServiceDescriptor

func (*ReadJSON) Read added in v0.0.5

func (m *ReadJSON) Read(ctx context.Context, method string, isClient bool, dataLen int, in bufiox.Reader) (interface{}, error)

Read read data from in thrift.TProtocol and convert to json string

func (*ReadJSON) SetBinaryWithBase64 added in v0.1.3

func (m *ReadJSON) SetBinaryWithBase64(enable bool)

SetBinaryWithBase64 enable/disable Base64 encoding for binary. Note that this method is not concurrent-safe.

func (*ReadJSON) SetDynamicGo added in v0.7.0

func (m *ReadJSON) SetDynamicGo(convOpts, convOptsWithException *conv.Options)

SetDynamicGo ...

type ReadStruct

type ReadStruct struct {
	// contains filtered or unexported fields
}

ReadStruct implement of MessageReaderWithMethod

func NewReadStruct

func NewReadStruct(svc *descriptor.ServiceDescriptor) *ReadStruct

NewReadStruct ...

func NewReadStructForJSON added in v0.4.3

func NewReadStructForJSON(svc *descriptor.ServiceDescriptor) *ReadStruct

func (*ReadStruct) Read

func (m *ReadStruct) Read(ctx context.Context, method string, isClient bool, dataLen int, in bufiox.Reader) (interface{}, error)

Read ...

func (*ReadStruct) SetBinaryOption added in v0.8.0

func (m *ReadStruct) SetBinaryOption(base64, byteSlice bool)

SetBinaryOption enable/disable Base64 encoding or returning []byte for binary. Note that this method is not concurrent-safe.

func (*ReadStruct) SetSetFieldsForEmptyStruct added in v0.9.1

func (m *ReadStruct) SetSetFieldsForEmptyStruct(mode uint8)

SetBinaryOption enable/disable set all fields in map-generic even if a struct is empty

mode == 0 means disable
mode == 1 means only set required and default fields
mode == 2 means set all fields

type StructReaderWriter added in v0.11.0

type StructReaderWriter struct {
	*ReadStruct
	*WriteStruct
}

func NewStructReaderWriter added in v0.11.0

func NewStructReaderWriter(svc *descriptor.ServiceDescriptor) *StructReaderWriter

func NewStructReaderWriterForJSON added in v0.11.0

func NewStructReaderWriterForJSON(svc *descriptor.ServiceDescriptor) *StructReaderWriter

type WriteBinary added in v0.11.0

type WriteBinary struct{}

WriteBinary implement of MessageWriter

func NewWriteBinary added in v0.11.0

func NewWriteBinary() *WriteBinary

func (*WriteBinary) Write added in v0.11.0

func (w *WriteBinary) Write(ctx context.Context, out bufiox.Writer, msg interface{}, method string, isClient bool, requestBase *base.Base) error

type WriteHTTPPbRequest added in v0.4.0

type WriteHTTPPbRequest struct {
	// contains filtered or unexported fields
}

WriteHTTPPbRequest implement of MessageWriter

func NewWriteHTTPPbRequest added in v0.4.0

func NewWriteHTTPPbRequest(svc *descriptor.ServiceDescriptor, pbSvc *desc.ServiceDescriptor) *WriteHTTPPbRequest

NewWriteHTTPPbRequest ... Base64 decoding for binary is enabled by default.

func (*WriteHTTPPbRequest) Write added in v0.4.0

func (w *WriteHTTPPbRequest) Write(ctx context.Context, out bufiox.Writer, msg interface{}, method string, isClient bool, requestBase *base.Base) error

Write ...

type WriteHTTPRequest

type WriteHTTPRequest struct {
	// contains filtered or unexported fields
}

WriteHTTPRequest implement of MessageWriter

func NewWriteHTTPRequest

func NewWriteHTTPRequest(svc *descriptor.ServiceDescriptor) *WriteHTTPRequest

NewWriteHTTPRequest ... Base64 decoding for binary is enabled by default.

func (*WriteHTTPRequest) SetBinaryWithBase64 added in v0.1.3

func (w *WriteHTTPRequest) SetBinaryWithBase64(enable bool)

SetBinaryWithBase64 enable/disable Base64 decoding for binary. Note that this method is not concurrent-safe.

func (*WriteHTTPRequest) SetDynamicGo added in v0.7.0

func (w *WriteHTTPRequest) SetDynamicGo(convOpts, convOptsWithThriftBase *conv.Options)

SetDynamicGo ...

func (*WriteHTTPRequest) Write

func (w *WriteHTTPRequest) Write(ctx context.Context, out bufiox.Writer, msg interface{}, method string, isClient bool, requestBase *base.Base) error

Write ...

type WriteJSON added in v0.0.5

type WriteJSON struct {
	// contains filtered or unexported fields
}

WriteJSON implement of MessageWriter

func NewWriteJSON added in v0.0.5

func NewWriteJSON(svc *descriptor.ServiceDescriptor) *WriteJSON

NewWriteJSON build WriteJSON according to ServiceDescriptor

func (*WriteJSON) SetBase64Binary added in v0.1.3

func (m *WriteJSON) SetBase64Binary(enable bool)

SetBase64Binary enable/disable Base64 decoding for binary. Note that this method is not concurrent-safe.

func (*WriteJSON) SetDynamicGo added in v0.7.0

func (m *WriteJSON) SetDynamicGo(convOpts, convOptsWithThriftBase *conv.Options)

SetDynamicGo ...

func (*WriteJSON) Write added in v0.0.5

func (m *WriteJSON) Write(ctx context.Context, out bufiox.Writer, msg interface{}, method string, isClient bool, requestBase *base.Base) error

Write write json string to out thrift.TProtocol

type WriteStruct

type WriteStruct struct {
	// contains filtered or unexported fields
}

WriteStruct implement of MessageWriter

func NewWriteStruct

func NewWriteStruct(svc *descriptor.ServiceDescriptor) *WriteStruct

NewWriteStruct ...

func (*WriteStruct) SetBinaryWithBase64 added in v0.7.0

func (m *WriteStruct) SetBinaryWithBase64(enable bool)

SetBinaryWithBase64 enable/disable Base64 decoding for binary. Note that this method is not concurrent-safe.

func (*WriteStruct) Write

func (m *WriteStruct) Write(ctx context.Context, out bufiox.Writer, msg interface{}, method string, isClient bool, requestBase *base.Base) error

Write ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL