Documentation ¶
Index ¶
- Constants
- Variables
- func CodeToHttpStatus(code codes.Code) int
- func HttpStatusToCode(status int) codes.Code
- func Serve(uriPart, filePath string, renderParams ...string) *content
- func ServeV2(uriPart, filePath, contentType string, renderParams ...string) *content
- type Ctx
- type ErrorHandler
- type ErrorResponse
- type HandlersInfoSnapshot
- type HttpService
- func (ss *HttpService) GetHandlersSnapshot() HandlersInfoSnapshot
- func (ss *HttpService) ListenAndServe(bindingAddress string) error
- func (ss *HttpService) Register(uri, method string, mType MType, handler interface{}) error
- func (ss *HttpService) RegisterControllers(uri string, handlers ...interface{}) error
- func (ss *HttpService) RegisterStatic(list ...*content) error
- func (ss *HttpService) Serve(ln net.Listener) error
- func (ss *HttpService) Shutdown() error
- type Interceptor
- type JsonRestClient
- func (jrc *JsonRestClient) Get(uri string, responsePtr interface{}) error
- func (jrc *JsonRestClient) Invoke(method, uri string, headers map[string]string, ...) error
- func (jrc *JsonRestClient) InvokeWithDynamicResponse(method, uri string, headers map[string]string, requestBody interface{}) (interface{}, error)
- func (jrc *JsonRestClient) InvokeWithoutHeaders(method, uri string, requestBody, responsePtr interface{}) error
- func (jrc *JsonRestClient) Post(uri string, requestBody, responsePtr interface{}) error
- type JsonRestClientOption
- type MType
- type Middleware
- type Option
- func WithErrorHandler(em ErrorHandler) Option
- func WithFastHttpEnhancer(enhancer func(s *fasthttp.Server)) Option
- func WithInterceptor(interceptor Interceptor) Option
- func WithMiddlewares(mws ...Middleware) Option
- func WithPostProcessors(pp ...func(c *Ctx)) Option
- func WithUnimplErrorHandler(em UnimplMethodErrorHandler) Option
- func WithValidator(validator Validator) Option
- type RESTFault
- type RestClient
- type UnimplMethodErrorHandler
- type ValidationErrors
- type Validator
Constants ¶
View Source
const ( RestMType = MType("rest") SoapMType = MType("soap") )
View Source
const ( POST = "POST" GET = "GET" )
Variables ¶
View Source
var ( ErrNotFunc = errors.New("'handler' is not a function") ErrInvalidFunc = errors.New(`'handler' invalid. Expecting function with ( [headers: map[string][string]], [requestBody: Any], [ctx: *fasthttp.RequestContext] ) params`) )
Functions ¶
func CodeToHttpStatus ¶
func HttpStatusToCode ¶
Types ¶
type Ctx ¶
type Ctx struct { *fasthttp.RequestCtx // contains filtered or unexported fields }
func (*Ctx) MappedRequestBody ¶
func (c *Ctx) MappedRequestBody() interface{}
func (*Ctx) MappedResponseBody ¶
func (c *Ctx) MappedResponseBody() interface{}
type ErrorHandler ¶
type ErrorResponse ¶
func (ErrorResponse) Error ¶
func (r ErrorResponse) Error() string
func (ErrorResponse) ToGrpcError ¶
func (r ErrorResponse) ToGrpcError() error
type HandlersInfoSnapshot ¶
type HandlersInfoSnapshot struct {
// contains filtered or unexported fields
}
func (HandlersInfoSnapshot) String ¶
func (s HandlersInfoSnapshot) String() string
type HttpService ¶
type HttpService struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(opts ...Option) *HttpService
func (*HttpService) GetHandlersSnapshot ¶
func (ss *HttpService) GetHandlersSnapshot() HandlersInfoSnapshot
func (*HttpService) ListenAndServe ¶
func (ss *HttpService) ListenAndServe(bindingAddress string) error
func (*HttpService) Register ¶
func (ss *HttpService) Register(uri, method string, mType MType, handler interface{}) error
func (*HttpService) RegisterControllers ¶
func (ss *HttpService) RegisterControllers(uri string, handlers ...interface{}) error
func (*HttpService) RegisterStatic ¶
func (ss *HttpService) RegisterStatic(list ...*content) error
func (*HttpService) Shutdown ¶
func (ss *HttpService) Shutdown() error
type Interceptor ¶
type JsonRestClient ¶
type JsonRestClient struct {
// contains filtered or unexported fields
}
func (*JsonRestClient) Get ¶
func (jrc *JsonRestClient) Get(uri string, responsePtr interface{}) error
func (*JsonRestClient) Invoke ¶
func (jrc *JsonRestClient) Invoke(method, uri string, headers map[string]string, requestBody, responsePtr interface{}) error
func (*JsonRestClient) InvokeWithDynamicResponse ¶
func (jrc *JsonRestClient) InvokeWithDynamicResponse(method, uri string, headers map[string]string, requestBody interface{}) (interface{}, error)
func (*JsonRestClient) InvokeWithoutHeaders ¶
func (jrc *JsonRestClient) InvokeWithoutHeaders(method, uri string, requestBody, responsePtr interface{}) error
func (*JsonRestClient) Post ¶
func (jrc *JsonRestClient) Post(uri string, requestBody, responsePtr interface{}) error
type JsonRestClientOption ¶
type JsonRestClientOption func(client *JsonRestClient)
func WithDefaultTimeout ¶
func WithDefaultTimeout(timeout time.Duration) JsonRestClientOption
func WithFasttHttpEnchacer ¶
func WithFasttHttpEnchacer(f func(*fasthttp.Client)) JsonRestClientOption
type Middleware ¶
type Option ¶
type Option func(ss *HttpService)
func WithErrorHandler ¶
func WithErrorHandler(em ErrorHandler) Option
func WithFastHttpEnhancer ¶
func WithInterceptor ¶
func WithInterceptor(interceptor Interceptor) Option
func WithMiddlewares ¶
func WithMiddlewares(mws ...Middleware) Option
func WithPostProcessors ¶
func WithUnimplErrorHandler ¶
func WithUnimplErrorHandler(em UnimplMethodErrorHandler) Option
func WithValidator ¶
type RestClient ¶
type RestClient interface { Invoke(method, uri string, headers map[string]string, requestBody, responsePtr interface{}) error InvokeWithoutHeaders(method, uri string, requestBody, responsePtr interface{}) error Post(uri string, requestBody, responsePtr interface{}) error Get(uri string, responsePtr interface{}) error InvokeWithDynamicResponse(method, uri string, headers map[string]string, requestBody interface{}) (interface{}, error) }
func NewJsonRestClient ¶
func NewJsonRestClient(opts ...JsonRestClientOption) RestClient
type ValidationErrors ¶
Click to show internal directories.
Click to hide internal directories.