Documentation
¶
Index ¶
- Constants
- Variables
- func Build(conf *config.Config, goPath, goRoot string)
- func ClearStats(r *http.Request)
- func ErrorCouldNotLoadArgs(w http.ResponseWriter)
- func ErrorCouldNotReply(w http.ResponseWriter)
- func ErrorFuncNotFound(w http.ResponseWriter)
- func ErrorMethodNotAllowed(w http.ResponseWriter)
- func ErrorReply(err error) any
- func GetCalledFunc(r *http.Request, endPoint string) string
- func InstrumentedService(middleware http.HandlerFunc, handleStats GoRPCCallStatsHandlerFun) http.HandlerFuncdeprecated
- func LoadArgs(args interface{}, callStats *CallStats, r *http.Request) error
- func MustRegisterUnionExt(v ...interface{})
- func NewMSGPackDecoderBytes(b []byte) *codec.Decoder
- func NewMSGPackEncoderBytes(b *[]byte) *codec.Encoder
- func NoopMonitor(w http.ResponseWriter, r *http.Request, args, rets []interface{}, ...)
- func RegisterUnionExt(v ...interface{}) error
- func RenderGoRPCClients(services ServiceList, longPackageName, packageName string, ...) (gocode string, err error)
- func RenderGoRPCProxies(services ServiceList, longPackageName, packageName string, ...) (gocode string, err error)
- func RenderGoTSRPCClients(services ServiceList, longPackageName, packageName string, ...) (gocode string, err error)
- func RenderGoTSRPCProxies(services ServiceList, longPackageName, packageName string, ...) (gocode string, err error)
- func RenderTypeScriptServices(services ServiceList, mappings config.TypeScriptMappings, ...) (typeScript string, err error)
- func Reply(response []interface{}, stats *CallStats, r *http.Request, ...) error
- func RequestWithStatsContext(r *http.Request) *http.Request
- func SetDefaultHttpClientFactory(factory HttpClientFactory)
- func SetJSONExt(rt interface{}, tag uint64, ext codec.InterfaceExt) error
- func SetMSGPackExt(rt interface{}, tag uint64, ext codec.BytesExt) error
- type Array
- type CallStats
- type Client
- type ClientEncoding
- type ClientError
- type Error
- type Field
- type GoRPCCallStatsHandlerFun
- type HTTPError
- type HttpClientFactory
- type JSONInfo
- type Map
- type Method
- type MonitorFn
- type ResponseWriter
- type Scalar
- type ScalarType
- type Service
- type ServiceList
- type ServiceMethods
- type Struct
- type StructType
- type UnionExt
- type Value
Constants ¶
View Source
const ( EncodingMsgpack = ClientEncoding(0) EncodingJson = ClientEncoding(1) //nolint:staticcheck )
View Source
const (
HeaderServiceToService = "X-Foomo-S2s"
)
Variables ¶
View Source
var ReaderTrace = false
Functions ¶
func ClearStats ¶
func ErrorCouldNotLoadArgs ¶
func ErrorCouldNotLoadArgs(w http.ResponseWriter)
func ErrorCouldNotReply ¶
func ErrorCouldNotReply(w http.ResponseWriter)
func ErrorFuncNotFound ¶
func ErrorFuncNotFound(w http.ResponseWriter)
func ErrorMethodNotAllowed ¶
func ErrorMethodNotAllowed(w http.ResponseWriter)
func ErrorReply ¶ added in v2.14.0
ErrorReply wraps an error return value so Reply can detect it at runtime. Used by generated proxy code for methods whose last return type is the error interface.
func InstrumentedService
deprecated
func InstrumentedService(middleware http.HandlerFunc, handleStats GoRPCCallStatsHandlerFun) http.HandlerFunc
Deprecated: will be removed
func MustRegisterUnionExt ¶
func MustRegisterUnionExt(v ...interface{})
func NewMSGPackDecoderBytes ¶
func NewMSGPackEncoderBytes ¶
func NoopMonitor ¶
func NoopMonitor(w http.ResponseWriter, r *http.Request, args, rets []interface{}, stats *CallStats)
func RegisterUnionExt ¶
func RegisterUnionExt(v ...interface{}) error
func RenderGoRPCClients ¶
func RenderGoRPCProxies ¶
func RenderGoTSRPCClients ¶
func RenderGoTSRPCProxies ¶
func Reply ¶
Reply although this is a public method - do not call it, it will be called by generated code
func SetDefaultHttpClientFactory ¶
func SetDefaultHttpClientFactory(factory HttpClientFactory)
func SetJSONExt ¶
func SetJSONExt(rt interface{}, tag uint64, ext codec.InterfaceExt) error
Types ¶
type CallStats ¶
type Client ¶
type Client interface {
Call(ctx context.Context, url string, endpoint string, method string, args []interface{}, reply []interface{}) (err error)
SetClientEncoding(encoding ClientEncoding)
SetTransportHttpClient(client *http.Client)
SetDefaultHeaders(headers http.Header)
}
func NewClientWithHttpClient ¶
type ClientEncoding ¶
type ClientEncoding int
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
func NewClientError ¶
func NewClientError(err error) *ClientError
type Error ¶
type GoRPCCallStatsHandlerFun ¶
type GoRPCCallStatsHandlerFun func(stats *CallStats)
type HTTPError ¶
func NewHTTPError ¶
type HttpClientFactory ¶
type MonitorFn ¶
type MonitorFn func(w http.ResponseWriter, r *http.Request, args, rets []interface{}, stats *CallStats)
var Monitor MonitorFn = NoopMonitor
type ResponseWriter ¶
type ResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
func (*ResponseWriter) Status ¶
func (r *ResponseWriter) Status() int
func (*ResponseWriter) WriteHeader ¶
func (r *ResponseWriter) WriteHeader(status int)
type Scalar ¶
type Scalar struct {
Name string
Package string
Type ScalarType
}
type ScalarType ¶
type ScalarType string
const ( ScalarTypeString ScalarType = "string" ScalarTypeAny ScalarType = "any" ScalarTypeByte ScalarType = "byte" ScalarTypeError ScalarType = "error" ScalarTypeNumber ScalarType = "number" ScalarTypeBool ScalarType = "bool" ScalarTypeNone ScalarType = "" )
type Service ¶
type Service struct {
Name string
Methods ServiceMethods
Endpoint string
IsInterface bool
}
type ServiceList ¶
type ServiceList []*Service
func Read ¶
func Read( goPaths []string, gomod config.Namespace, packageName string, serviceMap map[string]string, missingTypes map[string]bool, missingConstants map[string]bool, ) ( pkgName string, services ServiceList, structs map[string]*Struct, scalars map[string]*Scalar, constantTypes map[string]map[string]interface{}, err error, )
func (ServiceList) Len ¶
func (sl ServiceList) Len() int
func (ServiceList) Less ¶
func (sl ServiceList) Less(i, j int) bool
func (ServiceList) Swap ¶
func (sl ServiceList) Swap(i, j int)
type ServiceMethods ¶
type ServiceMethods []*Method
func (ServiceMethods) Len ¶
func (sm ServiceMethods) Len() int
func (ServiceMethods) Less ¶
func (sm ServiceMethods) Less(i, j int) bool
func (ServiceMethods) Swap ¶
func (sm ServiceMethods) Swap(i, j int)
type Struct ¶
type Struct struct {
IsError bool
Package string
Name string
Fields []*Field
UnionFields []*Field
InlineFields []*Field
Map *Map
Array *Array
}
func (*Struct) DepsSatisfied ¶
type StructType ¶
func (*StructType) FullName ¶
func (st *StructType) FullName() string
type UnionExt ¶
type UnionExt struct{}
func (*UnionExt) ConvertExt ¶
func (x *UnionExt) ConvertExt(v interface{}) interface{}
type Value ¶
type Value struct {
JSONInfo *JSONInfo `json:",omitempty"`
IsError bool `json:",omitempty"`
IsInterface bool `json:",omitempty"`
Scalar *Scalar `json:",omitempty"`
ScalarType ScalarType `json:",omitempty"`
GoScalarType string `json:",omitempty"`
StructType *StructType `json:",omitempty"`
Struct *Struct `json:",omitempty"`
Map *Map `json:",omitempty"`
Array *Array `json:",omitempty"`
IsPtr bool `json:",omitempty"`
}
Source Files
¶
- build.go
- bylen.go
- client.go
- clienterror.go
- code.go
- context.go
- error.go
- errorreply.go
- go.go
- gorpc.go
- gotsrpc.go
- http.go
- httperror.go
- instrumentation.go
- model.go
- monitor.go
- pool.go
- responsewriter.go
- servicereader.go
- stats.go
- transport.go
- transportjson.go
- transportmsgpack.go
- typereader.go
- typescript.go
- typscriptclient.go
- unionext.go
Click to show internal directories.
Click to hide internal directories.