Documentation ¶
Overview ¶
Package thrift provides thrift idl parser and codec for generic call
Index ¶
- Variables
- func Parse(tree *parser.Thrift, mode ParseMode) (*descriptor.ServiceDescriptor, error)
- func SetDefaultParseMode(m ParseMode)
- type Base
- func (p *Base) GetAddr() string
- func (p *Base) GetCaller() string
- func (p *Base) GetClient() string
- func (p *Base) GetExtra() map[string]string
- func (p *Base) GetLogID() string
- func (p *Base) GetTrafficEnv() *TrafficEnv
- func (p *Base) IsSetExtra() bool
- func (p *Base) IsSetTrafficEnv() bool
- func (p *Base) Read(iprot thrift.TProtocol) (err error)
- func (p *Base) ReadField1(iprot thrift.TProtocol) error
- func (p *Base) ReadField2(iprot thrift.TProtocol) error
- func (p *Base) ReadField3(iprot thrift.TProtocol) error
- func (p *Base) ReadField4(iprot thrift.TProtocol) error
- func (p *Base) ReadField5(iprot thrift.TProtocol) error
- func (p *Base) ReadField6(iprot thrift.TProtocol) error
- func (p *Base) SetAddr(val string)
- func (p *Base) SetCaller(val string)
- func (p *Base) SetClient(val string)
- func (p *Base) SetExtra(val map[string]string)
- func (p *Base) SetLogID(val string)
- func (p *Base) SetTrafficEnv(val *TrafficEnv)
- func (p *Base) String() string
- func (p *Base) Write(oprot thrift.TProtocol) (err error)
- type BaseResp
- func (p *BaseResp) GetExtra() map[string]string
- func (p *BaseResp) GetStatusCode() int32
- func (p *BaseResp) GetStatusMessage() string
- func (p *BaseResp) IsSetExtra() bool
- func (p *BaseResp) Read(iprot thrift.TProtocol) (err error)
- func (p *BaseResp) ReadField1(iprot thrift.TProtocol) error
- func (p *BaseResp) ReadField2(iprot thrift.TProtocol) error
- func (p *BaseResp) ReadField3(iprot thrift.TProtocol) error
- func (p *BaseResp) SetExtra(val map[string]string)
- func (p *BaseResp) SetStatusCode(val int32)
- func (p *BaseResp) SetStatusMessage(val string)
- func (p *BaseResp) String() string
- func (p *BaseResp) Write(oprot thrift.TProtocol) (err error)
- type MessageReader
- type MessageWriter
- type ParseMode
- type ReadHTTPResponse
- type ReadJSON
- type ReadStruct
- type TrafficEnv
- func (p *TrafficEnv) GetEnv() string
- func (p *TrafficEnv) GetOpen() bool
- func (p *TrafficEnv) Read(iprot thrift.TProtocol) (err error)
- func (p *TrafficEnv) ReadField1(iprot thrift.TProtocol) error
- func (p *TrafficEnv) ReadField2(iprot thrift.TProtocol) error
- func (p *TrafficEnv) SetEnv(val string)
- func (p *TrafficEnv) SetOpen(val bool)
- func (p *TrafficEnv) String() string
- func (p *TrafficEnv) Write(oprot thrift.TProtocol) (err error)
- type WriteHTTPRequest
- type WriteJSON
- type WriteStruct
Constants ¶
This section is empty.
Variables ¶
var BaseResp_Extra_DEFAULT map[string]string
var Base_Extra_DEFAULT map[string]string
Functions ¶
func Parse ¶
func Parse(tree *parser.Thrift, mode ParseMode) (*descriptor.ServiceDescriptor, error)
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 struct { LogID string `thrift:"LogID,1" json:"LogID"` Caller string `thrift:"Caller,2" json:"Caller"` Addr string `thrift:"Addr,3" json:"Addr"` Client string `thrift:"Client,4" json:"Client"` TrafficEnv *TrafficEnv `thrift:"TrafficEnv,5" json:"TrafficEnv,omitempty"` Extra map[string]string `thrift:"Extra,6" json:"Extra,omitempty"` }
func (*Base) GetTrafficEnv ¶
func (p *Base) GetTrafficEnv() *TrafficEnv
func (*Base) IsSetExtra ¶
func (*Base) IsSetTrafficEnv ¶
func (*Base) SetTrafficEnv ¶
func (p *Base) SetTrafficEnv(val *TrafficEnv)
type BaseResp ¶
type BaseResp struct { StatusMessage string `thrift:"StatusMessage,1" json:"StatusMessage"` StatusCode int32 `thrift:"StatusCode,2" json:"StatusCode"` Extra map[string]string `thrift:"Extra,3" json:"Extra,omitempty"` }
func NewBaseResp ¶
func NewBaseResp() *BaseResp
func (*BaseResp) GetStatusCode ¶
func (*BaseResp) GetStatusMessage ¶
func (*BaseResp) IsSetExtra ¶
func (*BaseResp) SetStatusCode ¶
func (*BaseResp) SetStatusMessage ¶
type MessageReader ¶
type MessageReader interface {
Read(ctx context.Context, method string, in thrift.TProtocol) (interface{}, error)
}
MessageReader read from thrift.TProtocol with method
type MessageWriter ¶
type MessageWriter interface {
Write(ctx context.Context, out thrift.TProtocol, msg interface{}, requestBase *Base) error
}
MessageWriter write to thrift.TProtocol
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 ReadHTTPResponse ¶
type ReadHTTPResponse struct {
// contains filtered or unexported fields
}
ReadHTTPResponse implement of MessageReaderWithMethod
func NewReadHTTPResponse ¶
func NewReadHTTPResponse(svc *descriptor.ServiceDescriptor) *ReadHTTPResponse
NewReadHTTPResponse ...
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, isClient bool) *ReadJSON
NewReadJSON build ReadJSON according to ServiceDescriptor
type ReadStruct ¶
type ReadStruct struct {
// contains filtered or unexported fields
}
ReadStruct implement of MessageReaderWithMethod
func NewReadStruct ¶
func NewReadStruct(svc *descriptor.ServiceDescriptor, isClient bool) *ReadStruct
NewReadStruct ...
type TrafficEnv ¶
type TrafficEnv struct { Open bool `thrift:"Open,1" json:"Open"` Env string `thrift:"Env,2" json:"Env"` }
var Base_TrafficEnv_DEFAULT *TrafficEnv
func NewTrafficEnv ¶
func NewTrafficEnv() *TrafficEnv
func (*TrafficEnv) GetEnv ¶
func (p *TrafficEnv) GetEnv() string
func (*TrafficEnv) GetOpen ¶
func (p *TrafficEnv) GetOpen() bool
func (*TrafficEnv) ReadField1 ¶
func (p *TrafficEnv) ReadField1(iprot thrift.TProtocol) error
func (*TrafficEnv) ReadField2 ¶
func (p *TrafficEnv) ReadField2(iprot thrift.TProtocol) error
func (*TrafficEnv) SetEnv ¶
func (p *TrafficEnv) SetEnv(val string)
func (*TrafficEnv) SetOpen ¶
func (p *TrafficEnv) SetOpen(val bool)
func (*TrafficEnv) String ¶
func (p *TrafficEnv) String() string
type WriteHTTPRequest ¶
type WriteHTTPRequest struct {
// contains filtered or unexported fields
}
WriteHTTPRequest implement of MessageWriter
func NewWriteHTTPRequest ¶
func NewWriteHTTPRequest(svc *descriptor.ServiceDescriptor) *WriteHTTPRequest
NewWriteHTTPRequest ...
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, method string, isClient bool) (*WriteJSON, error)
NewWriteJSON build WriteJSON according to ServiceDescriptor
type WriteStruct ¶
type WriteStruct struct {
// contains filtered or unexported fields
}
WriteStruct implement of MessageWriter
func NewWriteStruct ¶
func NewWriteStruct(svc *descriptor.ServiceDescriptor, method string, isClient bool) (*WriteStruct, error)
NewWriteStruct ...