Documentation
¶
Index ¶
- Variables
- func ContextWithOperators(ctx context.Context, ops ...courier.IOperator) context.Context
- func ContextWithRequest(ctx context.Context, req *http.Request) context.Context
- func ContextWithServiceName(ctx context.Context, serverName string) context.Context
- func CreateHttpHandler(s *ServeHTTP, ops ...courier.IOperator) httprouter.Handle
- func GetClientIP(r *http.Request) string
- func GetLongConnClient(timeout time.Duration) *http.Client
- func GetOperators(ctx context.Context) []courier.IOperator
- func GetParams(path string, url string) (params httprouter.Params, err error)
- func GetRequest(ctx context.Context) *http.Request
- func GetShortConnClient(timeout time.Duration) *http.Client
- func HttpStatusOK(code int) bool
- func MarshalOperator(r *http.Request, operator courier.IOperator) (err error)
- func PayloadMarshal(payload interface{}) ([]byte, error)
- func PayloadUnmarshal(data []byte, payload interface{}) error
- type BasePathDescriber
- type Binary
- type File
- type HttpRequest
- type HttpRouteMeta
- type IBytesGetter
- type IContentType
- type IHttpRequestTransformer
- type IMethod
- type IPath
- type IStatus
- type IWebSocket
- type Listener
- type Listeners
- type MetaOperator
- type MethodDescriber
- type Msg
- type OperatorFactoryWithRouteMeta
- type ParameterValuesGetter
- type PathDescriber
- type ResponseWriter
- type RouteMeta
- type ServeHTTP
- type TransportWrapper
- type TypeAndListener
- type WSClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ContextKeyServerName = uuid.New().String() ContextKeyRequest = uuid.New().String() ContextKeyOperators = uuid.New().String() )
View Source
var ProjectRef = os.Getenv("PROJECT_REF")
View Source
var RxHttpRouterPath = regexp.MustCompile("/:([^/]+)")
Functions ¶
func ContextWithOperators ¶
func ContextWithRequest ¶
func ContextWithServiceName ¶
func CreateHttpHandler ¶
func CreateHttpHandler(s *ServeHTTP, ops ...courier.IOperator) httprouter.Handle
func GetClientIP ¶
func HttpStatusOK ¶
func MarshalOperator ¶
func PayloadMarshal ¶
func PayloadUnmarshal ¶
Types ¶
type BasePathDescriber ¶
type BasePathDescriber interface {
BasePath() string
}
type Binary ¶
type Binary struct {
// contains filtered or unexported fields
}
swagger:strfmt binary
type File ¶
type File struct {
// contains filtered or unexported fields
}
swagger:strfmt binary
func (*File) ContentType ¶
type HttpRequest ¶
type HttpRequest struct {
BaseURL string
Method string
URI string
ID string
Metadata courier.Metadata
Timeout time.Duration
Req interface{}
WrapTransport TransportWrapper
}
func (*HttpRequest) Do ¶
func (httpRequest *HttpRequest) Do() (result courier.Result)
type HttpRouteMeta ¶
type HttpRouteMeta struct {
Route *courier.Route
OperatorFactoryWithRouteMetas []*OperatorFactoryWithRouteMeta
}
func NewHttpRouteMeta ¶
func NewHttpRouteMeta(route *courier.Route) *HttpRouteMeta
func (*HttpRouteMeta) Key ¶
func (route *HttpRouteMeta) Key() string
func (*HttpRouteMeta) Log ¶
func (route *HttpRouteMeta) Log()
func (*HttpRouteMeta) Method ¶
func (route *HttpRouteMeta) Method() string
func (*HttpRouteMeta) OperatorNames ¶
func (route *HttpRouteMeta) OperatorNames() string
func (*HttpRouteMeta) Path ¶
func (route *HttpRouteMeta) Path() string
func (*HttpRouteMeta) String ¶
func (route *HttpRouteMeta) String() string
type IBytesGetter ¶
type IBytesGetter interface {
Bytes() []byte
}
type IContentType ¶
type IContentType interface {
ContentType() string
}
type IHttpRequestTransformer ¶
type IWebSocket ¶
type MetaOperator ¶
type MetaOperator struct {
courier.EmptyOperator
// contains filtered or unexported fields
}
func BasePath ¶
func BasePath(basePath string) *MetaOperator
func Group ¶
func Group(path string) *MetaOperator
func (*MetaOperator) BasePath ¶
func (g *MetaOperator) BasePath() string
func (*MetaOperator) Path ¶
func (g *MetaOperator) Path() string
type MethodDescriber ¶
type MethodDescriber interface {
Method() string
}
type OperatorFactoryWithRouteMeta ¶
type OperatorFactoryWithRouteMeta struct {
*courier.OperatorFactory
RouteMeta
}
func NewOperatorFactoryWithRouteMeta ¶
func NewOperatorFactoryWithRouteMeta(op courier.IOperator, last bool) *OperatorFactoryWithRouteMeta
type ParameterValuesGetter ¶
type ParameterValuesGetter struct {
*transform.ParameterValuesGetter
Params *httprouter.Params
}
func (*ParameterValuesGetter) Param ¶
func (getter *ParameterValuesGetter) Param(name string) string
type PathDescriber ¶
type PathDescriber interface {
Path() string
}
type ResponseWriter ¶
type ResponseWriter struct {
http.ResponseWriter
Code int
// contains filtered or unexported fields
}
func (*ResponseWriter) Hijack ¶
func (w *ResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(code int)
type ServeHTTP ¶
type ServeHTTP struct {
Name string
IP string
Port int
WriteTimeout envconfig.Duration
ReadTimeout envconfig.Duration
WithCORS bool
// contains filtered or unexported fields
}
func (ServeHTTP) MarshalDefaults ¶
func (s ServeHTTP) MarshalDefaults(v interface{})
type TransportWrapper ¶
type TransportWrapper func(rt http.RoundTripper) http.RoundTripper
type TypeAndListener ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.