Documentation
¶
Index ¶
- Constants
- Variables
- func Background() http.Context
- func Cors() http.Middleware
- func DefaultTemplate() (*template.Template, error)
- func NewContext(instance *Instance, w nethttp.ResponseWriter, r *nethttp.Request) http.Context
- func NewContextRequest(ctx *Context, log log.Log, validation contractsvalidate.Validation) contractshttp.ContextRequest
- func NewGroup(config config.Config, instance *Instance, prefix string, ...) route.Router
- func NewTemplate(options RenderOptions) (*template.Template, error)
- func ResponseMiddleware() contractshttp.Middleware
- func Tls() contractshttp.Middleware
- type BodyWriter
- type Context
- func (c *Context) Context() context.Context
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Err() error
- func (c *Context) Instance() *Instance
- func (c *Context) Request() http.ContextRequest
- func (c *Context) Response() http.ContextResponse
- func (c *Context) Value(key any) any
- func (c *Context) WithValue(key string, value any)
- type ContextRequest
- func (r *ContextRequest) AbortWithStatus(code int)
- func (r *ContextRequest) AbortWithStatusJson(code int, jsonObj any)
- func (r *ContextRequest) All() map[string]any
- func (r *ContextRequest) Bind(obj any) error
- func (r *ContextRequest) BindQuery(obj any) error
- func (r *ContextRequest) Cookie(key string, defaultValue ...string) string
- func (r *ContextRequest) File(name string) (contractsfilesystem.File, error)
- func (r *ContextRequest) Form(key string, defaultValue ...string) string
- func (r *ContextRequest) FullUrl() string
- func (r *ContextRequest) HasSession() bool
- func (r *ContextRequest) Header(key string, defaultValue ...string) string
- func (r *ContextRequest) Headers() http.Header
- func (r *ContextRequest) Host() string
- func (r *ContextRequest) Input(key string, defaultValue ...string) string
- func (r *ContextRequest) InputArray(key string, defaultValue ...[]string) []string
- func (r *ContextRequest) InputBool(key string, defaultValue ...bool) bool
- func (r *ContextRequest) InputInt(key string, defaultValue ...int) int
- func (r *ContextRequest) InputInt64(key string, defaultValue ...int64) int64
- func (r *ContextRequest) InputMap(key string, defaultValue ...map[string]string) map[string]string
- func (r *ContextRequest) Ip() string
- func (r *ContextRequest) Json(key string, defaultValue ...string) string
- func (r *ContextRequest) Method() string
- func (r *ContextRequest) Next()
- func (r *ContextRequest) Origin() *http.Request
- func (r *ContextRequest) Path() string
- func (r *ContextRequest) Queries() map[string]string
- func (r *ContextRequest) Query(key string, defaultValue ...string) string
- func (r *ContextRequest) QueryArray(key string) []string
- func (r *ContextRequest) QueryBool(key string, defaultValue ...bool) bool
- func (r *ContextRequest) QueryInt(key string, defaultValue ...int) int
- func (r *ContextRequest) QueryInt64(key string, defaultValue ...int64) int64
- func (r *ContextRequest) QueryMap(key string) map[string]string
- func (r *ContextRequest) Route(key string) string
- func (r *ContextRequest) RouteInt(key string) int
- func (r *ContextRequest) RouteInt64(key string) int64
- func (r *ContextRequest) Session() contractsession.Session
- func (r *ContextRequest) SetSession(session contractsession.Session) contractshttp.ContextRequest
- func (r *ContextRequest) Url() string
- func (r *ContextRequest) Validate(rules map[string]string, options ...contractsvalidate.Option) (contractsvalidate.Validator, error)
- func (r *ContextRequest) ValidateRequest(request contractshttp.FormRequest) (contractsvalidate.Errors, error)
- type ContextResponse
- func (r *ContextResponse) Cookie(cookie contractshttp.Cookie) contractshttp.ContextResponse
- func (r *ContextResponse) Data(code int, contentType string, data []byte) contractshttp.Response
- func (r *ContextResponse) Download(filepath, filename string) contractshttp.Response
- func (r *ContextResponse) File(filepath string) contractshttp.Response
- func (r *ContextResponse) Flush()
- func (r *ContextResponse) Header(key, value string) contractshttp.ContextResponse
- func (r *ContextResponse) Json(code int, obj any) contractshttp.Response
- func (r *ContextResponse) NoContent(code ...int) contractshttp.Response
- func (r *ContextResponse) Origin() contractshttp.ResponseOrigin
- func (r *ContextResponse) Redirect(code int, location string) contractshttp.Response
- func (r *ContextResponse) Status(code int) contractshttp.ResponseStatus
- func (r *ContextResponse) Stream(code int, step func(w contractshttp.StreamWriter) error) contractshttp.Response
- func (r *ContextResponse) String(code int, format string, values ...any) contractshttp.Response
- func (r *ContextResponse) Success() contractshttp.ResponseStatus
- func (r *ContextResponse) View() contractshttp.ResponseView
- func (r *ContextResponse) WithoutCookie(name string) contractshttp.ContextResponse
- func (r *ContextResponse) Writer() http.ResponseWriter
- type DataResponse
- type Delims
- type DownloadResponse
- type FileResponse
- type Group
- func (r *Group) Any(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Delete(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Get(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Group(handler route.GroupFunc)
- func (r *Group) Middleware(middlewares ...httpcontract.Middleware) route.Router
- func (r *Group) Options(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Patch(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Post(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Prefix(addr string) route.Router
- func (r *Group) Put(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Resource(relativePath string, controller httpcontract.ResourceController)
- func (r *Group) Static(relativePath, root string)
- func (r *Group) StaticFS(relativePath string, fs http.FileSystem)
- func (r *Group) StaticFile(relativePath, filepath string)
- type HtmlResponse
- type Instance
- type JsonResponse
- type NoContentResponse
- type RedirectResponse
- type RenderOptions
- type Route
- func (r *Route) Fallback(handler httpcontract.HandlerFunc)
- func (r *Route) GlobalMiddleware(middlewares ...httpcontract.Middleware)
- func (r *Route) Run(host ...string) error
- func (r *Route) RunTLS(host ...string) error
- func (r *Route) RunTLSWithCert(host, certFile, keyFile string) error
- func (r *Route) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (r *Route) Shutdown(ctx ...context.Context) error
- type ServiceProvider
- type Status
- func (r *Status) Data(contentType string, data []byte) contractshttp.Response
- func (r *Status) Json(obj any) contractshttp.Response
- func (r *Status) Stream(step func(w contractshttp.StreamWriter) error) contractshttp.Response
- func (r *Status) String(format string, values ...any) contractshttp.Response
- type StreamResponse
- type StreamWriter
- type StringResponse
- type View
Constants ¶
View Source
const RouteBinding = "goravel.chi.route"
Variables ¶
View Source
var ( App foundation.Application ConfigFacade config.Config LogFacade log.Log ValidationFacade validation.Validation ViewFacade http.View )
Functions ¶
func Background ¶
func Cors ¶
func Cors() http.Middleware
func DefaultTemplate ¶
DefaultTemplate creates a TemplateRender instance with default options.
func NewContext ¶
func NewContextRequest ¶
func NewContextRequest(ctx *Context, log log.Log, validation contractsvalidate.Validation) contractshttp.ContextRequest
func NewGroup ¶
func NewGroup(config config.Config, instance *Instance, prefix string, originMiddlewares []httpcontract.Middleware, lastMiddlewares []httpcontract.Middleware) route.Router
func NewTemplate ¶
func NewTemplate(options RenderOptions) (*template.Template, error)
func ResponseMiddleware ¶
func ResponseMiddleware() contractshttp.Middleware
func Tls ¶
func Tls() contractshttp.Middleware
Types ¶
type BodyWriter ¶
type BodyWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func (*BodyWriter) Body ¶
func (w *BodyWriter) Body() *bytes.Buffer
func (*BodyWriter) Header ¶
func (w *BodyWriter) Header() http.Header
func (*BodyWriter) Size ¶
func (w *BodyWriter) Size() int
func (*BodyWriter) Status ¶
func (w *BodyWriter) Status() int
func (*BodyWriter) WriteHeader ¶
func (w *BodyWriter) WriteHeader(code int)
func (*BodyWriter) WriteString ¶
func (w *BodyWriter) WriteString(s string) (int, error)
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) Request ¶
func (c *Context) Request() http.ContextRequest
func (*Context) Response ¶
func (c *Context) Response() http.ContextResponse
type ContextRequest ¶
type ContextRequest struct {
// contains filtered or unexported fields
}
func (*ContextRequest) AbortWithStatus ¶
func (r *ContextRequest) AbortWithStatus(code int)
func (*ContextRequest) AbortWithStatusJson ¶
func (r *ContextRequest) AbortWithStatusJson(code int, jsonObj any)
func (*ContextRequest) All ¶
func (r *ContextRequest) All() map[string]any
func (*ContextRequest) Bind ¶
func (r *ContextRequest) Bind(obj any) error
func (*ContextRequest) BindQuery ¶
func (r *ContextRequest) BindQuery(obj any) error
func (*ContextRequest) Cookie ¶
func (r *ContextRequest) Cookie(key string, defaultValue ...string) string
func (*ContextRequest) File ¶
func (r *ContextRequest) File(name string) (contractsfilesystem.File, error)
func (*ContextRequest) Form ¶
func (r *ContextRequest) Form(key string, defaultValue ...string) string
func (*ContextRequest) FullUrl ¶
func (r *ContextRequest) FullUrl() string
func (*ContextRequest) HasSession ¶
func (r *ContextRequest) HasSession() bool
func (*ContextRequest) Header ¶
func (r *ContextRequest) Header(key string, defaultValue ...string) string
func (*ContextRequest) Headers ¶
func (r *ContextRequest) Headers() http.Header
func (*ContextRequest) Host ¶
func (r *ContextRequest) Host() string
func (*ContextRequest) Input ¶
func (r *ContextRequest) Input(key string, defaultValue ...string) string
func (*ContextRequest) InputArray ¶
func (r *ContextRequest) InputArray(key string, defaultValue ...[]string) []string
func (*ContextRequest) InputBool ¶
func (r *ContextRequest) InputBool(key string, defaultValue ...bool) bool
func (*ContextRequest) InputInt ¶
func (r *ContextRequest) InputInt(key string, defaultValue ...int) int
func (*ContextRequest) InputInt64 ¶
func (r *ContextRequest) InputInt64(key string, defaultValue ...int64) int64
func (*ContextRequest) Ip ¶
func (r *ContextRequest) Ip() string
func (*ContextRequest) Json ¶
func (r *ContextRequest) Json(key string, defaultValue ...string) string
func (*ContextRequest) Method ¶
func (r *ContextRequest) Method() string
func (*ContextRequest) Next ¶
func (r *ContextRequest) Next()
func (*ContextRequest) Origin ¶
func (r *ContextRequest) Origin() *http.Request
func (*ContextRequest) Path ¶
func (r *ContextRequest) Path() string
func (*ContextRequest) Queries ¶
func (r *ContextRequest) Queries() map[string]string
func (*ContextRequest) Query ¶
func (r *ContextRequest) Query(key string, defaultValue ...string) string
func (*ContextRequest) QueryArray ¶
func (r *ContextRequest) QueryArray(key string) []string
func (*ContextRequest) QueryBool ¶
func (r *ContextRequest) QueryBool(key string, defaultValue ...bool) bool
func (*ContextRequest) QueryInt ¶
func (r *ContextRequest) QueryInt(key string, defaultValue ...int) int
func (*ContextRequest) QueryInt64 ¶
func (r *ContextRequest) QueryInt64(key string, defaultValue ...int64) int64
func (*ContextRequest) Route ¶
func (r *ContextRequest) Route(key string) string
func (*ContextRequest) RouteInt ¶
func (r *ContextRequest) RouteInt(key string) int
func (*ContextRequest) RouteInt64 ¶
func (r *ContextRequest) RouteInt64(key string) int64
func (*ContextRequest) Session ¶
func (r *ContextRequest) Session() contractsession.Session
func (*ContextRequest) SetSession ¶
func (r *ContextRequest) SetSession(session contractsession.Session) contractshttp.ContextRequest
func (*ContextRequest) Url ¶
func (r *ContextRequest) Url() string
func (*ContextRequest) Validate ¶
func (r *ContextRequest) Validate(rules map[string]string, options ...contractsvalidate.Option) (contractsvalidate.Validator, error)
func (*ContextRequest) ValidateRequest ¶
func (r *ContextRequest) ValidateRequest(request contractshttp.FormRequest) (contractsvalidate.Errors, error)
type ContextResponse ¶
type ContextResponse struct {
// contains filtered or unexported fields
}
func NewContextResponse ¶
func NewContextResponse(ctx *Context, origin contractshttp.ResponseOrigin) *ContextResponse
func (*ContextResponse) Cookie ¶
func (r *ContextResponse) Cookie(cookie contractshttp.Cookie) contractshttp.ContextResponse
func (*ContextResponse) Data ¶
func (r *ContextResponse) Data(code int, contentType string, data []byte) contractshttp.Response
func (*ContextResponse) Download ¶
func (r *ContextResponse) Download(filepath, filename string) contractshttp.Response
func (*ContextResponse) File ¶
func (r *ContextResponse) File(filepath string) contractshttp.Response
func (*ContextResponse) Flush ¶
func (r *ContextResponse) Flush()
func (*ContextResponse) Header ¶
func (r *ContextResponse) Header(key, value string) contractshttp.ContextResponse
func (*ContextResponse) Json ¶
func (r *ContextResponse) Json(code int, obj any) contractshttp.Response
func (*ContextResponse) NoContent ¶
func (r *ContextResponse) NoContent(code ...int) contractshttp.Response
func (*ContextResponse) Origin ¶
func (r *ContextResponse) Origin() contractshttp.ResponseOrigin
func (*ContextResponse) Redirect ¶
func (r *ContextResponse) Redirect(code int, location string) contractshttp.Response
func (*ContextResponse) Status ¶
func (r *ContextResponse) Status(code int) contractshttp.ResponseStatus
func (*ContextResponse) Stream ¶
func (r *ContextResponse) Stream(code int, step func(w contractshttp.StreamWriter) error) contractshttp.Response
func (*ContextResponse) String ¶
func (r *ContextResponse) String(code int, format string, values ...any) contractshttp.Response
func (*ContextResponse) Success ¶
func (r *ContextResponse) Success() contractshttp.ResponseStatus
func (*ContextResponse) View ¶
func (r *ContextResponse) View() contractshttp.ResponseView
func (*ContextResponse) WithoutCookie ¶
func (r *ContextResponse) WithoutCookie(name string) contractshttp.ContextResponse
func (*ContextResponse) Writer ¶
func (r *ContextResponse) Writer() http.ResponseWriter
type DataResponse ¶
type DataResponse struct {
// contains filtered or unexported fields
}
func (*DataResponse) Render ¶
func (r *DataResponse) Render() error
type DownloadResponse ¶
type DownloadResponse struct {
// contains filtered or unexported fields
}
func (*DownloadResponse) Render ¶
func (r *DownloadResponse) Render() error
type FileResponse ¶
type FileResponse struct {
// contains filtered or unexported fields
}
func (*FileResponse) Render ¶
func (r *FileResponse) Render() error
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func (*Group) Any ¶
func (r *Group) Any(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Delete ¶
func (r *Group) Delete(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Get ¶
func (r *Group) Get(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Middleware ¶
func (r *Group) Middleware(middlewares ...httpcontract.Middleware) route.Router
func (*Group) Options ¶
func (r *Group) Options(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Patch ¶
func (r *Group) Patch(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Post ¶
func (r *Group) Post(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Put ¶
func (r *Group) Put(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Resource ¶
func (r *Group) Resource(relativePath string, controller httpcontract.ResourceController)
func (*Group) StaticFile ¶
type HtmlResponse ¶
type HtmlResponse struct {
// contains filtered or unexported fields
}
func (*HtmlResponse) Render ¶
func (r *HtmlResponse) Render() error
type JsonResponse ¶
type JsonResponse struct {
// contains filtered or unexported fields
}
func (*JsonResponse) Render ¶
func (r *JsonResponse) Render() error
type NoContentResponse ¶
type NoContentResponse struct {
// contains filtered or unexported fields
}
func (*NoContentResponse) Render ¶
func (r *NoContentResponse) Render() error
type RedirectResponse ¶
type RedirectResponse struct {
// contains filtered or unexported fields
}
func (*RedirectResponse) Render ¶
func (r *RedirectResponse) Render() error
type RenderOptions ¶
type Route ¶
func (*Route) Fallback ¶
func (r *Route) Fallback(handler httpcontract.HandlerFunc)
func (*Route) GlobalMiddleware ¶
func (r *Route) GlobalMiddleware(middlewares ...httpcontract.Middleware)
func (*Route) RunTLSWithCert ¶
type ServiceProvider ¶
type ServiceProvider struct{}
func (*ServiceProvider) Boot ¶
func (receiver *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (receiver *ServiceProvider) Register(app foundation.Application)
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
func (*Status) Stream ¶
func (r *Status) Stream(step func(w contractshttp.StreamWriter) error) contractshttp.Response
type StreamResponse ¶
type StreamResponse struct {
// contains filtered or unexported fields
}
func (*StreamResponse) Render ¶
func (r *StreamResponse) Render() error
type StreamWriter ¶
type StreamWriter struct {
// contains filtered or unexported fields
}
func NewStreamWriter ¶
func NewStreamWriter(render *chix.Render, w io.Writer) *StreamWriter
func (*StreamWriter) Flush ¶
func (w *StreamWriter) Flush() error
func (*StreamWriter) WriteString ¶
func (w *StreamWriter) WriteString(s string) (int, error)
type StringResponse ¶
type StringResponse struct {
// contains filtered or unexported fields
}
func (*StringResponse) Render ¶
func (r *StringResponse) Render() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.