Documentation ¶
Index ¶
- Constants
- Variables
- func SetContentParser(ctype string, f ContentParser)
- type AppError
- type CacheManager
- type ContentParser
- type Context
- func (c *Context) AddFlash(msg string)
- func (c *Context) AddHeader(header, value string)
- func (c *Context) AddHeaderVary(v string)
- func (c *Context) AllFlashes() []string
- func (c *Context) AppError() (ae AppError)
- func (c *Context) ClientIP(pref []string) (ip net.IP)
- func (c *Context) Close()
- func (c *Context) Cookie(cname string) (ck *http.Cookie)
- func (c *Context) CookieValue(cname string) string
- func (c *Context) DeleteCookie(cname string)
- func (c *Context) Error() string
- func (c *Context) ErrorCode() int
- func (c *Context) Flash() string
- func (c *Context) FwdedForOrRmteAddr() (ip net.IP)
- func (c *Context) HasError() bool
- func (c *Context) HasErrorCode() bool
- func (c *Context) HasFlash() bool
- func (c *Context) IfNoneMatch(etag string) int
- func (c *Context) IsAJAX() bool
- func (c *Context) IsAJAXOrCORS() bool
- func (c *Context) IsAjax() bool
- func (c *Context) IsAjaxOrCors() bool
- func (c *Context) IsCORS() bool
- func (c *Context) IsCors() bool
- func (c *Context) IsHTTPS() bool
- func (c *Context) IsHttps() bool
- func (c *Context) IsRedirecting() bool
- func (c *Context) IsSunnyContext() bool
- func (c *Context) LenFlashes() int
- func (c *Context) MapResourceValue(name string, ref interface{}) (err error)
- func (c *Context) Method() string
- func (c *Context) ParseRequestData()
- func (c *Context) PeekFlashes() []string
- func (c *Context) PostValue(name string) string
- func (c *Context) PostValues(name string) []string
- func (c *Context) PrivateNoCache()
- func (c *Context) PrivateNoStore()
- func (c *Context) PublicCache(age int)
- func (c *Context) QueryStr(s ...string) (qs Q)
- func (c *Context) RaiseAppError(err string, status ...int)
- func (c *Context) RecoverError()
- func (c *Context) Redirect(location string, state ...int)
- func (c *Context) RedirectOut(location string, state ...int)
- func (c *Context) Redirection() Redirection
- func (c *Context) RedirectionCode() int
- func (c *Context) RedirectionURL() string
- func (c *Context) RemoteAddress() net.IP
- func (c *Context) ReqHeader(header string) string
- func (c *Context) ReqHeaderHas(header, value string) bool
- func (c *Context) ReqHeaderIs(header, value string) bool
- func (c *Context) RequestBodyData(ctype string) map[string]interface{}
- func (c *Context) RequestValue(name string) string
- func (c *Context) RequestValues(name string) []string
- func (c *Context) ResHeader(header string) string
- func (c *Context) Resource(name string) (val interface{})
- func (c *Context) RootResponse() (resp http.ResponseWriter)
- func (c *Context) SetCookie(ck *http.Cookie)
- func (c *Context) SetCookieValue(name, value string)
- func (c *Context) SetETag(etag string) string
- func (c *Context) SetError(err string, status ...int)
- func (c *Context) SetErrorCode(status int)
- func (c *Context) SetHeader(header, value string)
- func (c *Context) SetRedirect(location string, state ...int) int
- func (c *Context) SetRedirectOut(location string, state ...int) (status int)
- func (c *Context) SetResource(name string, ref interface{})
- func (c *Context) SetTitle(title string)
- func (c *Context) StartTime() time.Time
- func (c *Context) SunnyServerID() int
- func (c *Context) ToWebSocket(upgrader *websocket.Upgrader, header http.Header) (err error)
- func (c *Context) URL(path string, qstr ...Q) string
- func (c *Context) URLQ(path string, s ...string) string
- func (c *Context) WaitRequestData() error
- func (c *Context) XMethod() string
- func (c *Context) XRealIPOrRmteAddr() (ip net.IP)
- type ContextError
- type ContextHandler
- type ContextOptionsHandler
- type ExpectationError
- type FormDate
- type FormDateTime
- type FormEmail
- type FormFloat
- type FormFloat64
- type FormInt
- type FormInt64
- type FormString
- type FormTime
- type FormURL
- type PData
- func (data PData) Date(key string) (d time.Time, err error)
- func (data PData) DateTime(key string) (dt time.Time, err error)
- func (data PData) Email(key string) (s string, err error)
- func (data PData) Float32(key string) (i float32, err error)
- func (data PData) Float64(key string) (i float64, err error)
- func (data PData) Int(key string) (i int, err error)
- func (data PData) Int64(key string) (i int64, err error)
- func (data PData) String(key string) (s string, err error)
- func (data PData) Time(key string) (t time.Duration, err error)
- func (data PData) URL(key string) (s string, err error)
- func (data PData) Url(key string) (string, error)
- type PathFloat
- type PathFloat64
- type PathInt
- type PathInt64
- type PathString
- type Q
- type RedirectError
- type Redirection
- type ResponseWriterChild
- type SessionManager
- type StatusCode
- type UPath
- func (upath UPath) Float32(index int) (i float32, err error)
- func (upath UPath) Float64(index int) (i float64, err error)
- func (upath UPath) GetFloat32(index int, def ...float32) (i float32)
- func (upath UPath) GetFloat64(index int, def ...float64) (i float64)
- func (upath UPath) GetInt(index int, def ...int) (i int)
- func (upath UPath) GetInt64(index int, def ...int64) (i int64)
- func (upath UPath) GetString(index int, def ...string) (s string)
- func (upath UPath) Int(index int) (i int, err error)
- func (upath UPath) Int64(index int) (i int64, err error)
- func (upath UPath) String(index int) (s string, err error)
- type UserModel
Constants ¶
View Source
const ( ReqmethodXMethodName = "X-HTTP-Method-Override" HTTPXForwardedFor = "X-Forwarded-For" HTTPXRealIP = "X-Real-IP" HTTPXRequestedWith = "X-Requested-With" )
View Source
const ( UserAnonymous int = iota UserUser UserPremiumUser UserWriter UserSuperWriter UserModerator UserSuperModerator UserAdmin UserSuperAdmin )
Variables ¶
View Source
var ErrResourceNotFound = errors.New("resource not found")
Functions ¶
func SetContentParser ¶
func SetContentParser(ctype string, f ContentParser)
Types ¶
type CacheManager ¶
type ContentParser ¶
func GetContentParser ¶
func GetContentParser(ctype string) ContentParser
type Context ¶
type Context struct { SetTitle_ func(string) Request *http.Request Response http.ResponseWriter UPath UPath PData PData Module string Controller string Action string Ext string Event *event.Router Session SessionManager Cache CacheManager MaxFileSize int64 WebSocket *websocket.Conn // contains filtered or unexported fields }
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request) *Context
func NewSunnyContext ¶
func (*Context) AddHeaderVary ¶
func (*Context) AllFlashes ¶
func (*Context) CookieValue ¶
func (*Context) DeleteCookie ¶
func (*Context) FwdedForOrRmteAddr ¶
func (*Context) HasErrorCode ¶
func (*Context) IfNoneMatch ¶
func (*Context) IsAJAXOrCORS ¶
func (*Context) IsAjaxOrCors ¶
func (*Context) IsRedirecting ¶
func (*Context) IsSunnyContext ¶
func (*Context) LenFlashes ¶
func (*Context) MapResourceValue ¶
func (*Context) ParseRequestData ¶
func (c *Context) ParseRequestData()
func (*Context) PeekFlashes ¶
func (*Context) PostValues ¶
func (*Context) PrivateNoCache ¶
func (c *Context) PrivateNoCache()
func (*Context) PrivateNoStore ¶
func (c *Context) PrivateNoStore()
func (*Context) PublicCache ¶
func (*Context) RaiseAppError ¶
func (*Context) RecoverError ¶
func (c *Context) RecoverError()
func (*Context) RedirectOut ¶
func (*Context) Redirection ¶
func (c *Context) Redirection() Redirection
func (*Context) RedirectionCode ¶
func (*Context) RedirectionURL ¶
func (*Context) RemoteAddress ¶
func (*Context) ReqHeaderHas ¶
func (*Context) ReqHeaderIs ¶
func (*Context) RequestBodyData ¶
func (*Context) RequestValue ¶
func (*Context) RequestValues ¶
func (*Context) RootResponse ¶
func (c *Context) RootResponse() (resp http.ResponseWriter)
func (*Context) SetCookieValue ¶
func (*Context) SetErrorCode ¶
func (*Context) SetRedirectOut ¶
func (*Context) SetResource ¶
func (*Context) SunnyServerID ¶
func (*Context) ToWebSocket ¶
func (*Context) WaitRequestData ¶
func (*Context) XRealIPOrRmteAddr ¶
type ContextError ¶
type ContextHandler ¶
type ContextHandler interface {
ServeContextHTTP(*Context)
}
type ContextOptionsHandler ¶
type ExpectationError ¶
type ExpectationError struct {
// contains filtered or unexported fields
}
func (ExpectationError) Code ¶
func (ee ExpectationError) Code() int
func (ExpectationError) Error ¶
func (ee ExpectationError) Error() string
func (ExpectationError) IncomingSize ¶
func (ee ExpectationError) IncomingSize() int64
func (ExpectationError) MaxFileSize ¶
func (ee ExpectationError) MaxFileSize() int64
type FormDateTime ¶
type FormFloat64 ¶
type FormFloat64 float64
type FormString ¶
type FormString string
type PathFloat64 ¶
type PathFloat64 float64
type PathString ¶
type PathString string
type RedirectError ¶
type RedirectError struct {
// contains filtered or unexported fields
}
func (RedirectError) Code ¶
func (re RedirectError) Code() int
func (RedirectError) Error ¶
func (re RedirectError) Error() string
func (RedirectError) URL ¶
func (re RedirectError) URL() string
type Redirection ¶
type Redirection struct {
// contains filtered or unexported fields
}
func (Redirection) Code ¶
func (r Redirection) Code() int
func (Redirection) URL ¶
func (r Redirection) URL() string
type ResponseWriterChild ¶
type ResponseWriterChild interface {
ParentResponseWriter() http.ResponseWriter
}
type SessionManager ¶
type SessionManager interface { ID() string String(string) string Int(string) int Int64(string) int64 Float32(string) float32 Float64(string) float64 Bool(string) bool Byte(string) byte Get(string) interface{} MapValue(string, interface{}) IPAddress() string UserAgent() string Created() time.Time Accessed() time.Time Expiry() time.Time AuthUser() UserModel Set(string, interface{}) Remove(string) SetIPAddress(string) SetUserAgent(string) SetExpiry(time.Time) SetAuthUser(UserModel) SetAuthUserData(id, email, name string, lvl int) SetAnonymous() IsAuthUser(id string) bool UpdateAccessed() AddFlash(string) HasFlash() bool Flash() string AllFlashes() []string PeekFlashes() []string LenFlashes() int }
type StatusCode ¶
type StatusCode int
Click to show internal directories.
Click to hide internal directories.