Documentation ¶
Index ¶
- Variables
- func GetFuncName(f interface{}) string
- func NewReqSchema(schema any) *reqSchema
- func Ternary(cond bool, trueValue any, defaultValue any) any
- func ToTitle(str string) string
- type App
- type Auth
- type CORS
- type Config
- type File
- type HandlerFunc
- type Headers
- type MapSA
- type MapSS
- type Methods
- type MthHandler
- type Request
- type Response
- func (w *Response) Abort(body any, code int, headers map[string]string)
- func (w *Response) BadRequest()
- func (w *Response) HTML(code int, body interface{})
- func (w *Response) HttpError(code int)
- func (w *Response) InternalServerError()
- func (w *Response) JSON(code int, body interface{})
- func (w *Response) NotFound()
- func (w *Response) Redirect(url_location string)
- func (w *Response) TEXT(code int, body interface{})
- type ResponseSchema
- type Route
- type RouteMatch
- type Router
- func (r *Router) AddNewRoute(url string, f HandlerFunc, name string, options map[string]interface{})
- func (r *Router) AddRoute(route *Route)
- func (r *Router) AfterRequest(f HandlerFunc)
- func (r *Router) BeforeRequest(f HandlerFunc)
- func (r *Router) Connect(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Delete(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Get(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Head(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Options(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Patch(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Post(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) Put(url string, f HandlerFunc, name string, options map[string]any)
- func (r *Router) TeardownRequest(f HandlerFunc)
- func (r *Router) Trace(url string, f HandlerFunc, name string, options map[string]any)
- type Schema
- type SecureSession
- type Session
- type SwaggerField
- type SwaggerRoute
- type SwaggerRouter
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnmatch = errors.New("ErrUnMatch") ErrMethodMismatch = errors.New("ErrMethodMismatch") )
Functions ¶
func GetFuncName ¶
func GetFuncName(f interface{}) string
func NewReqSchema ¶
func NewReqSchema(schema any) *reqSchema
Types ¶
type App ¶
type App struct { *Router // main router *Config // settings ErrorHandler map[string]HandlerFunc // map[statusCode]func // contains filtered or unexported fields }
func (*App) NewSecureSession ¶
func (app *App) NewSecureSession() *SecureSession
func (*App) ServeHTTP ¶
func (app *App) ServeHTTP(wr http.ResponseWriter, rq *http.Request)
match the endpoint and Parse the request, response...
func (*App) ShowRoutes ¶
func (app *App) ShowRoutes()
type CORS ¶
type Config ¶
type Config struct { // Environment Settings Env string // default: production Debug bool // default: production // app.Router Settings Host string // default: "" SecretKey string // default: "" ( necessario para o uso do Session ) // Static Files Settings StaticFolder string // default: "/front/assets" StaticUrlPath string // default: "/assets" // Session Settings CookiePath string // default: "/" CookieDomain string // default: "" CookieSecure bool // default: false CookieHttpOnly bool // default: true RefreshEachRequest bool // default: true CookieExpires time.Duration // default: default 1 hour CookiePermanent time.Duration // default: default 31 days CookieSameSite http.SameSite // default: http.http.SameSiteDefaultMode SessionCookieName string // default: "session" }
type File ¶
type File struct { Header *multipart.FileHeader Buffer *bytes.Buffer Size int64 Filename string ContentType string ContentLength int }
func NewFile ¶
func NewFile(fh *multipart.FileHeader) *File
type HandlerFunc ¶
type Methods ¶
type Methods map[string]*MthHandler
func NewMethods ¶
func NewMethods(mts map[string]HandlerFunc) Methods
type MthHandler ¶
type MthHandler struct { CORS *CORS Func HandlerFunc RequestSchema any ResponseSchema ResponseSchema // contains filtered or unexported fields }
type Request ¶
type Request struct { MatchInfo *RouteMatch // Request Parsed G MapSA // Global Variable App *App // the main app Args MapSS // url variables Auth *Auth // Auth headers parsed Form MapSS // form parsed in map[string]string Files map[string][]*File // map of formData parsed in Files ( if exists ) Session Session // the Sessions of current user // Native Request Cookies []*http.Cookie // []*http.Cookie ContentType string // alias for http.Request.Headers.Get("Content-Type") Method string // GET | POST | PUT ... URL *url_pkg.URL Header http.Header Host string RemoteAddr string RequestURI string Schema any // contains filtered or unexported fields }
type Response ¶
func NewResponse ¶
func NewResponse() *Response
func (*Response) BadRequest ¶
func (w *Response) BadRequest()
func (*Response) InternalServerError ¶
func (w *Response) InternalServerError()
type ResponseSchema ¶
type Route ¶
type Route struct { Url string // "/foo/bar/{foo:int}/{bar}" Name string // "FooBar" Func HandlerFunc // func(w *Response, r *Request){} Methods []string // ["GET", "POST", "DELETE"] HandlerMethods map[string]*MthHandler // CORS *CORS // iska.CORS{} RequestSchema any // any{} ResponseSchema ResponseSchema // map[string]any{200:{field:"foo",Field2: 1, Field3:Obj{...} }} // contains filtered or unexported fields }
type RouteMatch ¶
type RouteMatch struct { Route *Route Router *Router HttpVerb *MthHandler MatchErr error }
type Router ¶
type Router struct { CORS *CORS Name string UrlPrefix string Subdomain string AuthFunc func(*Response, *Request) (string, string) // before each request, for parse authorization headers // contains filtered or unexported fields }
func (*Router) AddNewRoute ¶
func (r *Router) AddNewRoute(url string, f HandlerFunc, name string, options map[string]interface{})
func (*Router) AfterRequest ¶
func (r *Router) AfterRequest(f HandlerFunc)
is execute after each request, if no raise a error
func (*Router) BeforeRequest ¶
func (r *Router) BeforeRequest(f HandlerFunc)
is execute before each request
func (*Router) TeardownRequest ¶
func (r *Router) TeardownRequest(f HandlerFunc)
is execute after dispache request ( no has effect in the request)
type SecureSession ¶
func (*SecureSession) Save ¶
func (s *SecureSession) Save(secret string)
func (*SecureSession) String ¶
func (s *SecureSession) String() ([]byte, error)
type SwaggerField ¶
type SwaggerRoute ¶
type SwaggerRoute struct{}
type SwaggerRouter ¶
type SwaggerRouter struct{}
Click to show internal directories.
Click to hide internal directories.