Documentation
¶
Overview ¶
Package generic ...
Index ¶
- func ServiceInfo(pcType serviceinfo.PayloadCodec) *serviceinfo.ServiceInfo
- type Args
- type DescriptorProvider
- type Generic
- type HTTPRequest
- type HTTPResponse
- type JSONRequest
- type Method
- type Result
- func (r *Result) GetSuccess() interface{}
- func (r *Result) IsSetSuccess() bool
- func (r *Result) Read(ctx context.Context, method string, in thrift.TProtocol) error
- func (r *Result) SetCodec(inner interface{})
- func (r *Result) SetSuccess(x interface{})
- func (r *Result) Write(ctx context.Context, out thrift.TProtocol) error
- type Service
- type ThriftContentProvider
- type ThriftContentWithAbsIncludePathProvider
- type WithCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServiceInfo ¶
func ServiceInfo(pcType serviceinfo.PayloadCodec) *serviceinfo.ServiceInfo
ServiceInfo create a generic ServiceInfo
Types ¶
type Args ¶
type Args struct {
Request interface{}
Method string
// contains filtered or unexported fields
}
Args generic request
func (*Args) GetOrSetBase ¶
func (g *Args) GetOrSetBase() interface{}
type DescriptorProvider ¶
type DescriptorProvider interface {
// Provide return a channel for provide service descriptors
Provide() <-chan *descriptor.ServiceDescriptor
}
DescriptorProvider provide service descriptor
func NewThriftFileProvider ¶
func NewThriftFileProvider(path string, includeDirs ...string) (DescriptorProvider, error)
NewThriftFileProvider create a ThriftIDLProvider by given path and include dirs
type Generic ¶
type Generic interface {
// PayloadCodec return codec implement
PayloadCodec() remote.PayloadCodec
// PayloadCodecType return the type of codec
PayloadCodecType() serviceinfo.PayloadCodec
// RawThriftBinaryGeneric must be framed
Framed() bool
// GetMethod to get method name if need
GetMethod(req interface{}, method string) (*Method, error)
}
Generic ...
func BinaryThriftGeneric ¶
func BinaryThriftGeneric() Generic
BinaryThriftGeneric raw thrift binary Generic
func HTTPThriftGeneric ¶
func HTTPThriftGeneric(p DescriptorProvider) (Generic, error)
HTTPThriftGeneric http mapping Generic
func MapThriftGeneric ¶
func MapThriftGeneric(p DescriptorProvider) (Generic, error)
MapThriftGeneric map mapping generic
type HTTPRequest ¶
type HTTPRequest = descriptor.HTTPRequest
HTTPRequest alias of descriptor HTTPRequest
func FromHTTPRequest ¶
func FromHTTPRequest(req *http.Request) (*HTTPRequest, error)
FromHTTPRequest parse HTTPRequest from http.Request
type HTTPResponse ¶
type HTTPResponse = descriptor.HTTPResponse
HTTPResponse alias of descriptor HTTPResponse
type Result ¶
type Result struct {
Success interface{}
// contains filtered or unexported fields
}
Result generic response
type Service ¶
type Service interface {
// GenericCall handle the generic call
GenericCall(ctx context.Context, method string, request interface{}) (response interface{}, err error)
}
Service generic service interface
type ThriftContentProvider ¶
type ThriftContentProvider struct {
// contains filtered or unexported fields
}
ThriftContentProvider provide descriptor from contents
func NewThriftContentProvider ¶
func NewThriftContentProvider(main string, includes map[string]string) (*ThriftContentProvider, error)
NewThriftContentProvider builder
func (*ThriftContentProvider) Provide ¶
func (p *ThriftContentProvider) Provide() <-chan *descriptor.ServiceDescriptor
Provide ...
type ThriftContentWithAbsIncludePathProvider ¶
type ThriftContentWithAbsIncludePathProvider struct {
// contains filtered or unexported fields
}
ThriftContentWithAbsIncludePathProvider ...
func NewThriftContentWithAbsIncludePathProvider ¶
func NewThriftContentWithAbsIncludePathProvider(mainIDLPath string, includes map[string]string) (*ThriftContentWithAbsIncludePathProvider, error)
NewThriftContentWithAbsIncludePathProvider create abs include path DescriptorProvider
func (*ThriftContentWithAbsIncludePathProvider) Provide ¶
func (p *ThriftContentWithAbsIncludePathProvider) Provide() <-chan *descriptor.ServiceDescriptor
Provide ...
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package test ...
|
Package test ... |
|
Package descriptor the idl descriptor for describe the idls with golang
|
Package descriptor the idl descriptor for describe the idls with golang |
|
Package test ...
|
Package test ... |
|
Package thrift thrift parser and codec
|
Package thrift thrift parser and codec |