thrift

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package thrift provides thrift idl parser and codec for generic call

Index

Constants

This section is empty.

Variables

View Source
var BaseResp_Extra_DEFAULT map[string]string
View Source
var Base_Extra_DEFAULT map[string]string

Functions

func Parse

Parse descriptor from parser.Thrift

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 NewBase

func NewBase() *Base

func (*Base) GetAddr

func (p *Base) GetAddr() string

func (*Base) GetCaller

func (p *Base) GetCaller() string

func (*Base) GetClient

func (p *Base) GetClient() string

func (*Base) GetExtra

func (p *Base) GetExtra() map[string]string

func (*Base) GetLogID

func (p *Base) GetLogID() string

func (*Base) GetTrafficEnv

func (p *Base) GetTrafficEnv() *TrafficEnv

func (*Base) IsSetExtra

func (p *Base) IsSetExtra() bool

func (*Base) IsSetTrafficEnv

func (p *Base) IsSetTrafficEnv() bool

func (*Base) Read

func (p *Base) Read(iprot thrift.TProtocol) (err error)

func (*Base) ReadField1

func (p *Base) ReadField1(iprot thrift.TProtocol) error

func (*Base) ReadField2

func (p *Base) ReadField2(iprot thrift.TProtocol) error

func (*Base) ReadField3

func (p *Base) ReadField3(iprot thrift.TProtocol) error

func (*Base) ReadField4

func (p *Base) ReadField4(iprot thrift.TProtocol) error

func (*Base) ReadField5

func (p *Base) ReadField5(iprot thrift.TProtocol) error

func (*Base) ReadField6

func (p *Base) ReadField6(iprot thrift.TProtocol) error

func (*Base) SetAddr

func (p *Base) SetAddr(val string)

func (*Base) SetCaller

func (p *Base) SetCaller(val string)

func (*Base) SetClient

func (p *Base) SetClient(val string)

func (*Base) SetExtra

func (p *Base) SetExtra(val map[string]string)

func (*Base) SetLogID

func (p *Base) SetLogID(val string)

func (*Base) SetTrafficEnv

func (p *Base) SetTrafficEnv(val *TrafficEnv)

func (*Base) String

func (p *Base) String() string

func (*Base) Write

func (p *Base) Write(oprot thrift.TProtocol) (err error)

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) GetExtra

func (p *BaseResp) GetExtra() map[string]string

func (*BaseResp) GetStatusCode

func (p *BaseResp) GetStatusCode() int32

func (*BaseResp) GetStatusMessage

func (p *BaseResp) GetStatusMessage() string

func (*BaseResp) IsSetExtra

func (p *BaseResp) IsSetExtra() bool

func (*BaseResp) Read

func (p *BaseResp) Read(iprot thrift.TProtocol) (err error)

func (*BaseResp) ReadField1

func (p *BaseResp) ReadField1(iprot thrift.TProtocol) error

func (*BaseResp) ReadField2

func (p *BaseResp) ReadField2(iprot thrift.TProtocol) error

func (*BaseResp) ReadField3

func (p *BaseResp) ReadField3(iprot thrift.TProtocol) error

func (*BaseResp) SetExtra

func (p *BaseResp) SetExtra(val map[string]string)

func (*BaseResp) SetStatusCode

func (p *BaseResp) SetStatusCode(val int32)

func (*BaseResp) SetStatusMessage

func (p *BaseResp) SetStatusMessage(val string)

func (*BaseResp) String

func (p *BaseResp) String() string

func (*BaseResp) Write

func (p *BaseResp) Write(oprot thrift.TProtocol) (err error)

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 ReadHTTPResponse

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

ReadHTTPResponse implement of MessageReaderWithMethod

func NewReadHTTPResponse

func NewReadHTTPResponse(svc *descriptor.ServiceDescriptor) *ReadHTTPResponse

NewReadHTTPResponse ...

func (*ReadHTTPResponse) Read

func (r *ReadHTTPResponse) Read(ctx context.Context, method string, in thrift.TProtocol) (interface{}, error)

Read ...

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

func (*ReadJSON) Read added in v0.0.5

func (m *ReadJSON) Read(ctx context.Context, method string, in thrift.TProtocol) (interface{}, error)

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

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 ...

func (*ReadStruct) Read

func (m *ReadStruct) Read(ctx context.Context, method string, in thrift.TProtocol) (interface{}, error)

Read ...

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) Read

func (p *TrafficEnv) Read(iprot thrift.TProtocol) (err error)

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

func (*TrafficEnv) Write

func (p *TrafficEnv) Write(oprot thrift.TProtocol) (err error)

type WriteHTTPRequest

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

WriteHTTPRequest implement of MessageWriter

func NewWriteHTTPRequest

func NewWriteHTTPRequest(svc *descriptor.ServiceDescriptor) *WriteHTTPRequest

NewWriteHTTPRequest ...

func (*WriteHTTPRequest) Write

func (w *WriteHTTPRequest) Write(ctx context.Context, out thrift.TProtocol, msg interface{}, requestBase *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, method string, isClient bool) (*WriteJSON, error)

NewWriteJSON build WriteJSON according to ServiceDescriptor

func (*WriteJSON) Write added in v0.0.5

func (m *WriteJSON) Write(ctx context.Context, out thrift.TProtocol, msg interface{}, requestBase *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, method string, isClient bool) (*WriteStruct, error)

NewWriteStruct ...

func (*WriteStruct) Write

func (m *WriteStruct) Write(ctx context.Context, out thrift.TProtocol, msg interface{}, requestBase *Base) error

Write ...

Jump to

Keyboard shortcuts

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