Documentation ¶
Index ¶
- Constants
- Variables
- func IsDebug() bool
- func SetDebugMode(value bool)
- func Validation(obj interface{}) []error
- type Context
- func (c *Context) Bind(ptr interface{}) error
- func (c *Context) ClientIP(forwarded bool) string
- func (c *Context) ContentType() string
- func (c *Context) Cookie(name string) (string, error)
- func (c *Context) CookieDef(name string, def string) string
- func (c *Context) DetectedSerializerName() string
- func (c *Context) FormFile(name string) (*multipart.FileHeader, error)
- func (c *Context) Get(key string) (value interface{}, ok bool)
- func (c *Context) GetBool(key string) (value bool, ok bool)
- func (c *Context) GetBoolDef(key string, def bool) bool
- func (c *Context) GetDef(key string, def interface{}) interface{}
- func (c *Context) GetDuration(key string) (value time.Duration, ok bool)
- func (c *Context) GetDurationDef(key string, def time.Duration) time.Duration
- func (c *Context) GetFloat(key string) (value float64, ok bool)
- func (c *Context) GetFloatDef(key string, def float64) float64
- func (c *Context) GetInt(key string) (value int64, ok bool)
- func (c *Context) GetIntDef(key string, def int64) int64
- func (c *Context) GetStr(key string) (value string, ok bool)
- func (c *Context) GetStrDef(key string, def string) string
- func (c *Context) GetUint(key string) (value uint64, ok bool)
- func (c *Context) GetUintDef(key string, def uint64) uint64
- func (c *Context) IsLocalRequest() bool
- func (c *Context) IsValid() bool
- func (c *Context) MultipartForm() (*multipart.Form, error)
- func (c *Context) MustCookie(name string) string
- func (c *Context) MustGet(key string) interface{}
- func (c *Context) MustParam(name string) string
- func (c *Context) MustParamBool(name string) bool
- func (c *Context) MustParamFloat(name string) float64
- func (c *Context) MustParamInt(name string) int64
- func (c *Context) MustPostForm(key string) string
- func (c *Context) MustPostFormArray(key string) []string
- func (c *Context) MustPostFormBool(key string) bool
- func (c *Context) MustPostFormFloat(key string) float64
- func (c *Context) MustPostFormInt(key string) int64
- func (c *Context) MustQuery(key string) string
- func (c *Context) MustQueryArray(key string) []string
- func (c *Context) MustQueryBool(key string) bool
- func (c *Context) MustQueryFloat(key string) float64
- func (c *Context) MustQueryInt(key string) int64
- func (c *Context) MustRequestHeader(key string) string
- func (c *Context) Next() IResponse
- func (c *Context) Param(name string) (value string, ok bool)
- func (c *Context) ParamBool(name string) (value bool, ok bool)
- func (c *Context) ParamBoolDef(name string, def bool) bool
- func (c *Context) ParamDef(name string, def string) string
- func (c *Context) ParamFloat(name string) (value float64, ok bool)
- func (c *Context) ParamFloatDef(name string, def float64) float64
- func (c *Context) ParamInt(name string) (value int64, ok bool)
- func (c *Context) ParamIntDef(name string, def int64) int64
- func (c *Context) PostForm(key string) (string, bool)
- func (c *Context) PostFormArray(key string) ([]string, bool)
- func (c *Context) PostFormArrayDef(key string, def []string) []string
- func (c *Context) PostFormBool(key string) (bool, bool)
- func (c *Context) PostFormBoolDef(key string, def bool) bool
- func (c *Context) PostFormDef(key, def string) string
- func (c *Context) PostFormFloat(key string) (float64, bool)
- func (c *Context) PostFormFloatDef(key string, def float64) float64
- func (c *Context) PostFormInt(key string) (int64, bool)
- func (c *Context) PostFormIntDef(key string, def int64) int64
- func (c *Context) Query(key string) (string, bool)
- func (c *Context) QueryArray(key string) ([]string, bool)
- func (c *Context) QueryArrayDef(key string, def []string) []string
- func (c *Context) QueryBool(key string) (bool, bool)
- func (c *Context) QueryBoolDef(key string, def bool) bool
- func (c *Context) QueryDef(key, def string) string
- func (c *Context) QueryFloat(key string) (float64, bool)
- func (c *Context) QueryFloatDef(key string, def float64) float64
- func (c *Context) QueryInt(key string) (int64, bool)
- func (c *Context) QueryIntDef(key string, def int64) int64
- func (c *Context) R(name string) IRenderer
- func (c *Context) Renderer(name string) IRenderer
- func (c *Context) RequestHeader(key string) (string, bool)
- func (c *Context) RequestHeaderDef(key string, def string) string
- func (c *Context) RequestUrlScheme() string
- func (c *Context) ResetBodyReaderPosition() error
- func (c *Context) RouteBasePath() string
- func (c *Context) S(names ...string) ISerializer
- func (c *Context) Serializer(names ...string) ISerializer
- func (c *Context) Set(key string, value interface{}) *Context
- func (c *Context) Tr(message string, vars ...interface{}) string
- func (c *Context) Trans(message string, vars ...interface{}) string
- func (c *Context) UserAgent() string
- type Error
- type ErrorCause
- type FormSerializer
- func (s FormSerializer) Charset() string
- func (s FormSerializer) DefaultContentType(withCharset bool) string
- func (FormSerializer) Deserialize(data []byte, v interface{}) error
- func (FormSerializer) Name() string
- func (s FormSerializer) Response(status int, data interface{}) IResponse
- func (s FormSerializer) Serialize(v interface{}) ([]byte, error)
- type H
- type HTMLRenderer
- func (r *HTMLRenderer) AddFunc(name string, i interface{}) IRenderer
- func (r *HTMLRenderer) DefaultContentType(withCharset bool) string
- func (r *HTMLRenderer) LoadTemplateFiles(fileNames ...string) error
- func (r *HTMLRenderer) LoadTemplateGlob(name, pattern string) error
- func (r *HTMLRenderer) RemoveFunc(name string) IRenderer
- func (r *HTMLRenderer) Render(name string, data interface{}) ([]byte, error)
- func (r *HTMLRenderer) Response(status int, name string, data interface{}) IResponse
- type HandlerFunc
- type IApplication
- type IProfiler
- type IRenderer
- type IResponse
- type IRoute
- type IRouteInfo
- type IRouter
- type ISerializeInput
- type ISerializer
- type ISerializerManager
- type ITemplatingManager
- type ITranslator
- type JsonSerializer
- func (s JsonSerializer) Charset() string
- func (s JsonSerializer) DefaultContentType(withCharset bool) string
- func (JsonSerializer) Deserialize(data []byte, v interface{}) error
- func (JsonSerializer) Name() string
- func (s JsonSerializer) Response(status int, data interface{}) IResponse
- func (JsonSerializer) Serialize(v interface{}) ([]byte, error)
- type Response
- type Router
- func (r *Router) ANY(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) BasePath() string
- func (r *Router) CheckPath(path string) (map[string]string, bool)
- func (r *Router) CountHandlers() int
- func (r *Router) DELETE(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) GET(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) Group(relativePath string, handlers ...HandlerFunc) IRouter
- func (r *Router) HEAD(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) HandlerByIndex(index int) (HandlerFunc, bool)
- func (r *Router) OPTIONS(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) PATCH(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) POST(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) PUT(relativePath string, handlers ...HandlerFunc) IRoute
- func (r *Router) Static(relativePath, root string) IRoute
- func (r *Router) StaticFS(relativePath string, fs http.FileSystem) IRoute
- func (r *Router) StaticFile(relativePath, filePath string) IRoute
- func (r *Router) Use(middleware ...HandlerFunc) IRoute
- type TranslationMap
- type ValidationError
- type XmlSerializer
- func (s XmlSerializer) Charset() string
- func (s XmlSerializer) DefaultContentType(withCharset bool) string
- func (XmlSerializer) Deserialize(data []byte, v interface{}) error
- func (XmlSerializer) Name() string
- func (s XmlSerializer) Response(status int, data interface{}) IResponse
- func (XmlSerializer) Serialize(v interface{}) ([]byte, error)
Constants ¶
const ( Version = "v0.1.18" DebugEnvName = "JUST_DEBUG_MODE" )
const ( ContentTypeHeaderKey = "Content-Type" StrongRedirectHeaderKey = "__StrongRedirect" ServeFileHeaderKey = "__ServeFilePath" )
Variables ¶
var ( ErrEmptyRequest = errors.New("empty request") ErrEmptyRequestBody = errors.New("empty request body") ErrNotFoundSerializer = errors.New("not find serializer for content type in your request") ErrNotFoundUrlSerializer = errors.New("not find serializer for url query (application/x-www-form-urlencoded)") )
Errors
var ( ErrUnknownType = errors.New("unknown type") ErrBlankTimeFormat = errors.New("blank time format") ErrOnlyStructUrlEncode = errors.New("array and slice by root element not supported, only structure") )
var ( ErrInvalidContext = errors.New("invalid context") ErrRecoverInvalidResponse = errors.New("invalid response, recover panic") )
Errors
var ( ErrEmptyReader = errors.New("reader is empty") ErrUnsupportedReader = errors.New("reader is not supported") )
Errors
var (
ErrEmptyTemplates = errors.New("have hot templates")
)
Errors
var (
ErrSerializeOperationsDisabled = errors.New("serialize operations disabled")
)
Functions ¶
func Validation ¶
func Validation(obj interface{}) []error
Validation of the structure of the object according to the parameters within the tags.
Types ¶
type Context ¶
type Context struct { // Public props. Meta map[string]interface{} // Metadata. Request *http.Request // HTTP request. IsFrozenRequestBody bool // Use frozen request body (default true). // contains filtered or unexported fields }
Request Context struct.
func (*Context) ClientIP ¶
ClientIP implements a best effort algorithm to return the real client IP, it parses X-Real-IP and X-Forwarded-For in order to work properly with reverse-proxies such us: nginx or haproxy. Use X-Forwarded-For before X-Real-Ip as nginx uses X-Real-Ip with the proxy's IP.
func (*Context) ContentType ¶
Get the Content-Type header of the request.
func (*Context) Cookie ¶
Cookie returns the named cookie provided in the request or ErrNoCookie if not found. And return the named cookie is unescaped. If multiple cookies match the given name, only one cookie will be returned.
func (*Context) DetectedSerializerName ¶
func (*Context) FormFile ¶
func (c *Context) FormFile(name string) (*multipart.FileHeader, error)
Get multipart.FileHeader from MultipartForm by name.
func (*Context) GetBoolDef ¶
Get bool metadata by key with default value.
func (*Context) GetDuration ¶
Get duration metadata by key.
func (*Context) GetDurationDef ¶
Get duration metadata by key with default value.
func (*Context) GetFloatDef ¶
Get float metadata by key with default value.
func (*Context) GetUintDef ¶
Get unsigned integer metadata by key with default value.
func (*Context) IsLocalRequest ¶
func (*Context) MultipartForm ¶
MultipartForm is the parsed multipart form, including file uploads.
func (*Context) MustCookie ¶
func (*Context) MustParamBool ¶
func (*Context) MustParamFloat ¶
func (*Context) MustParamInt ¶
func (*Context) MustPostForm ¶
func (*Context) MustPostFormArray ¶
func (*Context) MustPostFormBool ¶
func (*Context) MustPostFormFloat ¶
func (*Context) MustPostFormInt ¶
func (*Context) MustQueryArray ¶
func (*Context) MustQueryBool ¶
func (*Context) MustQueryFloat ¶
func (*Context) MustQueryInt ¶
func (*Context) MustRequestHeader ¶
func (*Context) ParamBoolDef ¶
Get bool route param by name with the default value.
func (*Context) ParamFloat ¶
Get float route param by name.
func (*Context) ParamFloatDef ¶
Get float route param by name with the default value.
func (*Context) ParamIntDef ¶
Get integer route param by name with the default value.
func (*Context) PostForm ¶
PostForm returns the specified key from a POST urlencoded form or multipart form when it exists, otherwise it returns an empty string `("")`.
func (*Context) PostFormArrayDef ¶
func (*Context) PostFormDef ¶
PostForm returns the specified key from a POST urlencoded form or multipart form with default value.
func (*Context) PostFormFloatDef ¶
func (*Context) QueryArray ¶
Get array query param by key.
func (*Context) QueryArrayDef ¶
Get array query param by key with default value.
func (*Context) QueryBoolDef ¶
Get bool query param by key with default value.
func (*Context) QueryFloat ¶
Get float query param by key.
func (*Context) QueryFloatDef ¶
Get float query param by key with default value.
func (*Context) QueryIntDef ¶
Get integer query param by key with default value.
func (*Context) RequestHeader ¶
Get request header string value by key.
func (*Context) RequestHeaderDef ¶
Get request header string value by key with default value.
func (*Context) RequestUrlScheme ¶
Get url scheme from request, supported X-Scheme and X-Forwarded-Proto headers.
func (*Context) ResetBodyReaderPosition ¶
Reset body reader position.
func (*Context) S ¶
func (c *Context) S(names ...string) ISerializer
Short name for serializer method
func (*Context) Serializer ¶
func (c *Context) Serializer(names ...string) ISerializer
Get serializer by name or content type (without names - default serializer, or auto detected serializer).
type Error ¶
type Error struct { XMLName xml.Name `json:"-" xml:"error"` Code string `json:"code,omitempty" xml:"code,attr,omitempty"` Message string `json:"msg" xml:"msg"` Causes []ErrorCause `json:"causes,omitempty" xml:"causes,omitempty"` Metadata H `json:"metadata,omitempty" xml:"metadata,omitempty"` }
Error struct.
type ErrorCause ¶
type ErrorCause struct { XMLName xml.Name `json:"-" xml:"cause"` Path string `json:"path,omitempty" xml:"path,attr,omitempty"` Target string `json:"target,omitempty" xml:"target,attr,omitempty"` Description string `json:"desc,omitempty" xml:"desc,omitempty"` }
Reason struct for error.
type FormSerializer ¶
Form serializer (form-data, x-www-form-urlencoded).
func (FormSerializer) Charset ¶
func (s FormSerializer) Charset() string
func (FormSerializer) DefaultContentType ¶
func (s FormSerializer) DefaultContentType(withCharset bool) string
func (FormSerializer) Deserialize ¶
func (FormSerializer) Deserialize(data []byte, v interface{}) error
func (FormSerializer) Name ¶
func (FormSerializer) Name() string
func (FormSerializer) Response ¶
func (s FormSerializer) Response(status int, data interface{}) IResponse
func (FormSerializer) Serialize ¶
func (s FormSerializer) Serialize(v interface{}) ([]byte, error)
type H ¶
type H map[string]interface{}
H is a shortcup for map[string]interface{} (to improve code reading).
func (H) MarshalXML ¶
Overriding for Marshal to XML
type HTMLRenderer ¶
type HTMLRenderer struct { Charset string // contains filtered or unexported fields }
HTML template engine.
func (*HTMLRenderer) AddFunc ¶
func (r *HTMLRenderer) AddFunc(name string, i interface{}) IRenderer
Add Func to HTML templates.
func (*HTMLRenderer) DefaultContentType ¶
func (r *HTMLRenderer) DefaultContentType(withCharset bool) string
Content Type by default for HTMLRenderer.
func (*HTMLRenderer) LoadTemplateFiles ¶
func (r *HTMLRenderer) LoadTemplateFiles(fileNames ...string) error
Load HTML template files.
func (*HTMLRenderer) LoadTemplateGlob ¶
func (r *HTMLRenderer) LoadTemplateGlob(name, pattern string) error
Load HTML template glob.
func (*HTMLRenderer) RemoveFunc ¶
func (r *HTMLRenderer) RemoveFunc(name string) IRenderer
Remove Func from HTML templates.
type HandlerFunc ¶
Method of processing a request or middleware.
type IApplication ¶
type IApplication interface { IRouter Profiler() IProfiler Translator() ITranslator SerializerManager() ISerializerManager TemplatingManager() ITemplatingManager LocalDo(req *http.Request) IResponse SetProfiler(p IProfiler) IApplication SetTranslator(t ITranslator) IApplication SetNoRouteHandler(handler HandlerFunc) IApplication SetNoImplementedHandler(handler HandlerFunc) IApplication ServeHTTP(w http.ResponseWriter, req *http.Request) Run(address string) error RunTLS(address, certFile, keyFile string) error }
JUST Application interface.
func NewClear ¶
func NewClear() IApplication
Create new clear JUST application. Without serializers and renderers.
func SetDefRenderers ¶
func SetDefRenderers(app IApplication) IApplication
Set default renderers (HTML UTF-8)
func SetDefSerializers ¶
func SetDefSerializers(app IApplication) IApplication
Set default serializer to just application (json, xml, form-data, x-www-form-urlencoded)
type IProfiler ¶
type IProfiler interface { OnStartRequest(*http.Request) // Event start processing HTTP request. OnSelectRoute(*http.Request, IRouteInfo) // Event select route for request. OnWriteResponseData([]byte) // Event write data to response. OnWriteResponseHeader(int, http.Header) // Event write headers to response. Info(...interface{}) // Send info message to profiler. Error(...interface{}) // Send error message to profiler. Warning(...interface{}) // Send warning message to profiler. Debug(...interface{}) // Send debug message to profiler. }
Profiler interface.
type IRenderer ¶
type IRenderer interface { DefaultContentType(withCharset bool) string LoadTemplateFiles(fileNames ...string) error LoadTemplateGlob(name, pattern string) error AddFunc(name string, i interface{}) IRenderer RemoveFunc(name string) IRenderer Render(name string, data interface{}) ([]byte, error) Response(status int, name string, data interface{}) IResponse }
Interface for rendering templates.
type IResponse ¶
type IResponse interface { // Checkers HasData() bool HasHeaders() bool HasStreamHandler() bool // Getters GetData() []byte GetStatus() int GetHeaders() map[string]string GetStreamHandler() (http.HandlerFunc, bool) }
Response interface.
func FileResponse ¶
Create a response in the form of a local file.
func RedirectResponse ¶
Create a redirect response (Use _StrongRedirect in header to set location)
func StreamResponse ¶
func StreamResponse(handler http.HandlerFunc) IResponse
Create a stream response.
type IRoute ¶
type IRoute interface { IRouteInfo // Use middleware. Use(...HandlerFunc) IRoute // Processing of requests to the application server. Handle(string, string, ...HandlerFunc) IRoute ANY(string, ...HandlerFunc) IRoute GET(string, ...HandlerFunc) IRoute POST(string, ...HandlerFunc) IRoute DELETE(string, ...HandlerFunc) IRoute PATCH(string, ...HandlerFunc) IRoute PUT(string, ...HandlerFunc) IRoute OPTIONS(string, ...HandlerFunc) IRoute HEAD(string, ...HandlerFunc) IRoute StaticFile(string, string) IRoute Static(string, string) IRoute StaticFS(string, http.FileSystem) IRoute CheckPath(string) (map[string]string, bool) }
Route interface.
type IRouteInfo ¶
type IRouteInfo interface { BasePath() string CountHandlers() int HandlerByIndex(index int) (HandlerFunc, bool) }
Interface information on route.
type IRouter ¶
type IRouter interface { IRoute Group(string, ...HandlerFunc) IRouter }
Router interface.
type ISerializeInput ¶
type ISerializeInput interface { Data() interface{} Options() interface{} }
Input interface serializer.
type ISerializer ¶
type ISerializer interface { Name() string // Name serializer. Charset() string // Get Charset serializer. DefaultContentType(withCharset bool) string // The default content type. Serialize(interface{}) ([]byte, error) // Serialize obj/objs to bytes. Deserialize([]byte, interface{}) error // Deserialize bytes tp obj/objs. Response(status int, data interface{}) IResponse // Serialize obj/objs to IResponse. }
Serializer interface.
type ISerializerManager ¶
type ISerializerManager interface { Names() []string DefaultName() (string, bool) SetDefaultName(string) ISerializerManager SetSerializer(string, []string, ISerializer) ISerializerManager Serializer(n string, byContent bool) ISerializer }
Serializer manager interface to manage the serializers.
type ITemplatingManager ¶
type ITemplatingManager interface { SetRenderer(name string, r IRenderer) Renderer(name string) IRenderer }
Interface Template Manager.
type ITranslator ¶
type ITranslator interface { DefaultLocale() string SetDefaultLocale(locale string) ITranslator AddTranslationMap(locale string, m TranslationMap) ITranslator Trans(locale string, message string, vars ...interface{}) string // Translate text for locale and vars. }
Translator interface.
type JsonSerializer ¶
type JsonSerializer struct {
Ch string // Charset for generate Content-Type header.
}
Base JSON serializer.
func (JsonSerializer) Charset ¶
func (s JsonSerializer) Charset() string
func (JsonSerializer) DefaultContentType ¶
func (s JsonSerializer) DefaultContentType(withCharset bool) string
func (JsonSerializer) Deserialize ¶
func (JsonSerializer) Deserialize(data []byte, v interface{}) error
func (JsonSerializer) Name ¶
func (JsonSerializer) Name() string
func (JsonSerializer) Response ¶
func (s JsonSerializer) Response(status int, data interface{}) IResponse
func (JsonSerializer) Serialize ¶
func (JsonSerializer) Serialize(v interface{}) ([]byte, error)
type Response ¶
type Response struct { Status int // HTTP status (200, 201,...). Bytes []byte // Data bytes. Headers map[string]string // Response headers. Stream http.HandlerFunc // Stream method, to support standard HTTP package, as well as to work with WS. }
Base Response struct.
func (*Response) GetHeaders ¶
func (Response) GetStreamHandler ¶
func (r Response) GetStreamHandler() (http.HandlerFunc, bool)
func (Response) HasHeaders ¶
func (Response) HasStreamHandler ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Base Router struct.
func (*Router) ANY ¶
func (r *Router) ANY(relativePath string, handlers ...HandlerFunc) IRoute
Any registers a route that matches all the HTTP methods. GET, POST, PUT, PATCH, DELETE.
func (*Router) CountHandlers ¶
func (*Router) DELETE ¶
func (r *Router) DELETE(relativePath string, handlers ...HandlerFunc) IRoute
DELETE is a shortcut for router.Handle("DELETE", path, handlers...).
func (*Router) GET ¶
func (r *Router) GET(relativePath string, handlers ...HandlerFunc) IRoute
GET is a shortcut for router.Handle("GET", path, handlers...).
func (*Router) Group ¶
func (r *Router) Group(relativePath string, handlers ...HandlerFunc) IRouter
Create group router. The group does not support regular expressions, text only.
func (*Router) HEAD ¶
func (r *Router) HEAD(relativePath string, handlers ...HandlerFunc) IRoute
HEAD is a shortcut for router.Handle("HEAD", path, handlers...).
func (*Router) Handle ¶
func (r *Router) Handle(httpMethod, relativePath string, handlers ...HandlerFunc) IRoute
Create a HTTP request handler.
func (*Router) HandlerByIndex ¶
func (r *Router) HandlerByIndex(index int) (HandlerFunc, bool)
func (*Router) OPTIONS ¶
func (r *Router) OPTIONS(relativePath string, handlers ...HandlerFunc) IRoute
OPTIONS is a shortcut for router.Handle("OPTIONS", path, handlers...).
func (*Router) PATCH ¶
func (r *Router) PATCH(relativePath string, handlers ...HandlerFunc) IRoute
PATCH is a shortcut for router.Handle("PATCH", path, handlers...).
func (*Router) POST ¶
func (r *Router) POST(relativePath string, handlers ...HandlerFunc) IRoute
POST is a shortcut for router.Handle("POST", path, handlers...).
func (*Router) PUT ¶
func (r *Router) PUT(relativePath string, handlers ...HandlerFunc) IRoute
PUT is a shortcut for router.Handle("PUT", path, handlers...).
func (*Router) Static ¶
Static serves files from the given file system root. Internally a http.FileServer is used, therefore http.NotFound is used instead of the Router's NotFound handler. To use the operating system's file system implementation, use: `router.Static("/static", "/var/www")`
func (*Router) StaticFS ¶
func (r *Router) StaticFS(relativePath string, fs http.FileSystem) IRoute
StaticFS works just like `Static()` but a custom `http.FileSystem` can be used instead.
func (*Router) StaticFile ¶
StaticFile registers a single route in order to server a single file of the local filesystem. `router.StaticFile("favicon.ico", "./resources/favicon.ico")`
type ValidationError ¶
Structure validation errors.
type XmlSerializer ¶
type XmlSerializer struct {
Ch string // Charset for generate Content-Type header.
}
Base XML serializer.
func (XmlSerializer) Charset ¶
func (s XmlSerializer) Charset() string
func (XmlSerializer) DefaultContentType ¶
func (s XmlSerializer) DefaultContentType(withCharset bool) string
func (XmlSerializer) Deserialize ¶
func (XmlSerializer) Deserialize(data []byte, v interface{}) error
func (XmlSerializer) Name ¶
func (XmlSerializer) Name() string
func (XmlSerializer) Response ¶
func (s XmlSerializer) Response(status int, data interface{}) IResponse
func (XmlSerializer) Serialize ¶
func (XmlSerializer) Serialize(v interface{}) ([]byte, error)