Documentation ¶
Index ¶
- Constants
- func CloseSessionStorage()
- func CompressFilter(in *In) bool
- func DeleteItem(slice interface{}, i int)
- func DestroySession(w http.ResponseWriter, r *http.Request, s *Session)
- func FlushSession(s *Session) error
- func FormatPath(rawpath string) string
- func InsertItem(slice interface{}, i int, val interface{})
- func IntMax(a, b int) int
- func LocalizeTemplate(templateStr string, langcode string, provider i18n.Provider) string
- func NewMockFileInfo(name string, size int64, mode os.FileMode, modTime time.Time, isDir bool) os.FileInfo
- func NoCacheFilter(in *In) bool
- func RegisterControllerGlobal(controller IController)
- func RegisterSessionStorageDriver(name string, engine ISessionDBEngine)
- func ServedByProxyFilter(in *In) bool
- func SetCookieAdv(w http.ResponseWriter, name string, value string, path string, domain string, ...)
- func SetCookieSimple(w http.ResponseWriter, key string, value string)
- func SetUserLang(w http.ResponseWriter, r *http.Request, langcode string)
- func StrConcat(strings ...string) string
- func StringIndexOf(haystack []string, needle string) int
- type ActionDefinition
- type App
- func (a *App) AddRouteLine(line string) error
- func (a *App) AddTemplateFunc(key string, tfunc interface{})
- func (a *App) AddTemplateFuncMap(tfmap map[string]interface{})
- func (a *App) BenchLoadAll() error
- func (a *App) DefaultGetLang(w http.ResponseWriter, r *http.Request) string
- func (a *App) DoHTTPError(w http.ResponseWriter, r *http.Request, err int)
- func (a *App) GetLayout(name string) *template.Template
- func (a *App) GetLocalizedLayout(name string, w http.ResponseWriter, r *http.Request) *template.Template
- func (a *App) GetLocalizedViewTemplate(localpath string, w http.ResponseWriter, r *http.Request) *template.Template
- func (app *App) GetSession(w http.ResponseWriter, r *http.Request) *Session
- func (a *App) GetViewTemplate(localpath string) *template.Template
- func (app *App) InitSessionStorage(driver string) error
- func (app *App) Listen() error
- func (app *App) LoadConfigFile() error
- func (app *App) Logvln(v ...interface{})
- func (a *App) RegisterController(c IController)
- func (app *App) ServeFile(w http.ResponseWriter, r *http.Request, name string) int
- func (app *App) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type AppConfig
- type AppError
- type ByteCache
- type ByteCacheCollection
- type ConnectionData
- type Controller
- type DatabaseConfig
- type ErrorPageContent
- type Filter
- type GenericCache
- type GenericCacheCollection
- func (c *GenericCacheCollection) DeleteCache(name string)
- func (c *GenericCacheCollection) GetCache(name string) *GenericCache
- func (c *GenericCacheCollection) InvalidateCache(name string)
- func (c *GenericCacheCollection) IsValid(name string) bool
- func (c *GenericCacheCollection) SetCache(name string, data interface{})
- type IController
- type ISession
- type ISessionDBEngine
- type In
- func (in *In) BeforeOutput(f InFunc)
- func (in *In) Continue() *Out
- func (in *In) Defer(f func())
- func (in *In) FormFile(key string) (multipart.File, *multipart.FileHeader, error)
- func (in *In) FormVal(key string) string
- func (in *In) New() *In
- func (in *In) OutputBytes(b []byte) *Out
- func (in *In) OutputContentAsJSON() *Out
- func (in *In) OutputFile(name string) *Out
- func (in *In) OutputJSON(jobj interface{}) *Out
- func (in *In) OutputLay(layout string) *Out
- func (in *In) OutputLayTpl(layout, tplPath string) *Out
- func (in *In) OutputSoloTpl(tplPath string) *Out
- func (in *In) OutputString(str string) *Out
- func (in *In) OutputTpl(tplPath string) *Out
- func (in *In) OutputXML(xobj interface{}) *Out
- func (in *In) ReqBody() *InBodyWrapper
- func (in *In) Session() *Session
- func (in *In) SetNoCache() *In
- func (in *In) SprintFormVals(format string, keys ...string) string
- func (in *In) T(format string, v ...interface{}) string
- func (in *In) URLQ() url.Values
- type InBodyWrapper
- type InContent
- func (c *InContent) All() map[string]interface{}
- func (c *InContent) Del(key string) *InContent
- func (c *InContent) Get2(key string) (val interface{}, ok bool)
- func (c *InContent) GetInt2(key string) (val int, ok bool)
- func (c *InContent) GetString2(key string) (val string, ok bool)
- func (c *InContent) Merge(v interface{}) *InContent
- func (c *InContent) MergeNoOverwrite(v interface{}) *InContent
- func (c *InContent) Set(key string, val interface{}) *InContent
- type InFunc
- type Logger
- type MockResponseWriter
- type Out
- type PageContent
- type Params
- type RedirectPageContent
- type Route
- type RouteMatch
- type Router
- type SessFlash
- type Session
- func (s *Session) DeleteData(key string)
- func (s *Session) Expire(t time.Time)
- func (s *Session) Flush()
- func (s *Session) GetBool(key string) (bool, bool)
- func (s *Session) GetBoolD(key string, defaultValue bool) bool
- func (s *Session) GetData() (string, map[string]interface{}, time.Time)
- func (s *Session) GetExpires() time.Time
- func (s *Session) GetInt32(key string) (int, bool)
- func (s *Session) GetInt32D(key string, defaultValue int) int
- func (s *Session) GetInt64(key string) (int64, bool)
- func (s *Session) GetInt64D(key string, defaultValue int64) int64
- func (s *Session) GetString(key string) (string, bool)
- func (s *Session) GetStringD(key string, defaultValue string) string
- func (s *Session) RequestURI() string
- type SessionDevNull
- func (s *SessionDevNull) Cleanup(minTime time.Time)
- func (s *SessionDevNull) Close()
- func (s *SessionDevNull) GetSession(sid string) (*Session, error)
- func (s *SessionDevNull) NewSession(s2 *Session) error
- func (s *SessionDevNull) PutSession(s2 *Session) error
- func (s *SessionDevNull) RemoveSession(s2 *Session) error
- func (s *SessionDevNull) SetApp(app *App)
- type TemplateProcessor
Constants ¶
View Source
const ( ErrNil = 0 // TLS ErrTLSNil = 100 )
Variables ¶
This section is empty.
Functions ¶
func CloseSessionStorage ¶
func CloseSessionStorage()
func CompressFilter ¶
func DeleteItem ¶
func DeleteItem(slice interface{}, i int)
func DestroySession ¶
func DestroySession(w http.ResponseWriter, r *http.Request, s *Session)
func FlushSession ¶
func FormatPath ¶
func InsertItem ¶
func InsertItem(slice interface{}, i int, val interface{})
func LocalizeTemplate ¶
func NewMockFileInfo ¶ added in v0.11.5
func NoCacheFilter ¶ added in v0.11.5
func RegisterControllerGlobal ¶ added in v0.4.4
func RegisterControllerGlobal(controller IController)
func RegisterSessionStorageDriver ¶
func RegisterSessionStorageDriver(name string, engine ISessionDBEngine)
func ServedByProxyFilter ¶ added in v0.11.5
func SetCookieAdv ¶
func SetCookieSimple ¶
func SetCookieSimple(w http.ResponseWriter, key string, value string)
SetCookieSimple sets an unsafe cookie
func SetUserLang ¶
func SetUserLang(w http.ResponseWriter, r *http.Request, langcode string)
func StringIndexOf ¶
Types ¶
type ActionDefinition ¶ added in v0.3.0
func (*ActionDefinition) String ¶ added in v0.3.0
func (a *ActionDefinition) String() string
type App ¶
type App struct { // public AppConfigPath string Config *AppConfig Router *Router Filters []Filter StaticFilters []Filter ByteCaches *ByteCacheCollection GenericCaches *GenericCacheCollection Random *rand.Rand HTTPErrorFunc func(w http.ResponseWriter, r *http.Request, err int) GetLangFunc func(w http.ResponseWriter, r *http.Request) string ServeMux *httprouter.Router Monitor appMonitor Logger Logger AccessLogger Logger TemplateProcessor TemplateProcessor I18nProvider i18n.Provider // contains filtered or unexported fields }
func (*App) AddRouteLine ¶ added in v0.4.4
func (*App) AddTemplateFunc ¶ added in v0.2.1
func (*App) AddTemplateFuncMap ¶ added in v0.2.1
func (*App) BenchLoadAll ¶ added in v0.4.4
func (*App) DefaultGetLang ¶ added in v0.11.5
func (*App) DoHTTPError ¶
func (*App) GetLocalizedLayout ¶
func (*App) GetLocalizedViewTemplate ¶
func (*App) GetSession ¶ added in v0.3.0
func (*App) InitSessionStorage ¶
func (*App) LoadConfigFile ¶
func (*App) RegisterController ¶
func (a *App) RegisterController(c IController)
type AppConfig ¶
type AppConfig struct { Name string `yaml:"Name"` DomainName string `yaml:"DomainName"` CookieDomain string `yaml:"CookieDomain"` CookiePath string `yaml:"CookiePath"` GlobalPageTitle string `json:",omitempty"` Version string `yaml:"Version"` HostAddr string `yaml:"HostAddr"` HostAddrTLS string `yaml:"HostAddrTLS"` MongoDbs string `yaml:"MongoDbs"` Database string `yaml:"Database"` Databases map[string]DatabaseConfig `yaml:"Databases"` SessionDb interface{} `yaml:"SessionDb"` Salt string `yaml:"Salt"` LocalePath string `yaml:"LocalePath"` DefaultLanguage string `yaml:"DefaultLanguage"` Data map[string]string `yaml:"Data"` // TLS TLSCertificatePath string `yaml:"TLSCertificatePath"` TLSKeyPath string `yaml:"TLSKeyPath"` TLSRedirect bool `yaml:"TLSRedirect"` TLSRedirectPort string `yaml:"TLSRedirectPort"` TLSAutocert bool `yaml:"TLSAutocert"` TLSAutocertWhitelist []string `yaml:"TLSAutocertWhitelist"` RawTLSKey string `yaml:"RawTLSKey"` RawTLSCert string `yaml:"RawTLSCert"` // Paths RoutesConfigPath string `yaml:"RoutesConfigPath"` CachePath string `yaml:"CachePath"` ViewsFolderPath string `yaml:"ViewsFolderPath"` ViewsExtensions []string `yaml:"ViewsExtensions"` // .html, .tpl PublicFolderPath string `yaml:"PublicFolderPath"` WatchViewsFolder bool `yaml:"WatchViewsFolder"` StaticAccessLog bool DynamicAccessLog bool Verbose bool GZipDynamic bool GZipStatic bool SessionDebug bool `yaml:"SessionDebug"` StaticIndexFiles []string `yaml:"StaticIndexFiles"` //Gracefully restarts if enabled GracefulRestart bool }
type ByteCacheCollection ¶
type ByteCacheCollection struct {
// contains filtered or unexported fields
}
func NewByteCacheCollection ¶
func NewByteCacheCollection() *ByteCacheCollection
func (*ByteCacheCollection) DeleteCache ¶
func (c *ByteCacheCollection) DeleteCache(name string)
func (*ByteCacheCollection) GetCache ¶
func (c *ByteCacheCollection) GetCache(name string) *ByteCache
func (*ByteCacheCollection) InvalidateCache ¶
func (c *ByteCacheCollection) InvalidateCache(name string)
func (*ByteCacheCollection) IsValid ¶
func (c *ByteCacheCollection) IsValid(name string) bool
func (*ByteCacheCollection) SetCache ¶
func (c *ByteCacheCollection) SetCache(name string, data []byte)
type ConnectionData ¶ added in v0.11.5
type Controller ¶
type Controller struct { App *App Path string Name string LayoutName string Action string LayoutAction string Params []string PageTitle string Layout string ContentType string // contains filtered or unexported fields }
func (*Controller) GetApp ¶ added in v0.11.5
func (c *Controller) GetApp() *App
func (*Controller) GetLayoutName ¶
func (c *Controller) GetLayoutName() string
func (*Controller) GetPageTitle ¶
func (c *Controller) GetPageTitle() string
func (*Controller) Init ¶
func (c *Controller) Init()
func (*Controller) PreFilter ¶
func (c *Controller) PreFilter(in *In) *Out
func (*Controller) SetApp ¶ added in v0.3.0
func (c *Controller) SetApp(app *App)
type DatabaseConfig ¶
type ErrorPageContent ¶
type GenericCache ¶
type GenericCacheCollection ¶
type GenericCacheCollection struct {
// contains filtered or unexported fields
}
func NewGenericCacheCollection ¶
func NewGenericCacheCollection() *GenericCacheCollection
func (*GenericCacheCollection) DeleteCache ¶
func (c *GenericCacheCollection) DeleteCache(name string)
func (*GenericCacheCollection) GetCache ¶
func (c *GenericCacheCollection) GetCache(name string) *GenericCache
func (*GenericCacheCollection) InvalidateCache ¶
func (c *GenericCacheCollection) InvalidateCache(name string)
func (*GenericCacheCollection) IsValid ¶
func (c *GenericCacheCollection) IsValid(name string) bool
func (*GenericCacheCollection) SetCache ¶
func (c *GenericCacheCollection) SetCache(name string, data interface{})
type IController ¶
type ISessionDBEngine ¶
type In ¶
type In struct { R *http.Request W http.ResponseWriter Wsock *websocket.Conn URLParts []string Params Params // set in the new routing method Content *InContent LayoutContent *InContent App *App Controller IController LangCode string GlobalTitle string // contains filtered or unexported fields }
func (*In) BeforeOutput ¶ added in v0.11.5
func (*In) New ¶ added in v0.2.0
New clones a new In but without the content. Useful to render separate parts
func (*In) OutputBytes ¶ added in v0.2.0
func (*In) OutputContentAsJSON ¶ added in v0.11.5
func (*In) OutputFile ¶ added in v0.3.0
func (*In) OutputJSON ¶
func (*In) OutputLayTpl ¶ added in v0.2.0
func (*In) OutputSoloTpl ¶
func (*In) OutputString ¶
func (*In) ReqBody ¶ added in v0.3.0
func (in *In) ReqBody() *InBodyWrapper
func (*In) SetNoCache ¶ added in v0.2.1
func (*In) SprintFormVals ¶ added in v0.11.5
type InBodyWrapper ¶ added in v0.3.0
func (*InBodyWrapper) UnmarshalJSON ¶ added in v0.3.0
func (inbw *InBodyWrapper) UnmarshalJSON(v interface{}) error
func (*InBodyWrapper) UnmarshalXML ¶ added in v0.3.0
func (inbw *InBodyWrapper) UnmarshalXML(v interface{}) error
type InContent ¶
type InContent struct {
// contains filtered or unexported fields
}
func (*InContent) MergeNoOverwrite ¶ added in v0.11.5
type Logger ¶ added in v0.3.0
type Logger interface { Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) Fatalln(v ...interface{}) Flags() int Output(calldepth int, s string) error Panic(v ...interface{}) Panicf(format string, v ...interface{}) Panicln(v ...interface{}) Prefix() string Print(v ...interface{}) Printf(format string, v ...interface{}) Println(v ...interface{}) SetFlags(flag int) SetPrefix(prefix string) }
func DefaultLogger ¶ added in v0.3.0
func DefaultLogger() Logger
type MockResponseWriter ¶ added in v0.11.5
type MockResponseWriter struct {
// contains filtered or unexported fields
}
func (*MockResponseWriter) Body ¶ added in v0.11.5
func (w *MockResponseWriter) Body() []byte
func (*MockResponseWriter) Header ¶ added in v0.11.5
func (w *MockResponseWriter) Header() http.Header
func (*MockResponseWriter) StatusCode ¶ added in v0.11.5
func (w *MockResponseWriter) StatusCode() int
func (*MockResponseWriter) StringBody ¶ added in v0.11.5
func (w *MockResponseWriter) StringBody() string
func (*MockResponseWriter) Write ¶ added in v0.11.5
func (w *MockResponseWriter) Write(b []byte) (int, error)
func (*MockResponseWriter) WriteHeader ¶ added in v0.11.5
func (w *MockResponseWriter) WriteHeader(status int)
type Out ¶
type Out struct {
// contains filtered or unexported fields
}
func (*Out) IsContinue ¶ added in v0.2.0
func (*Out) Render ¶ added in v0.11.5
func (o *Out) Render(w http.ResponseWriter)
type PageContent ¶
type RedirectPageContent ¶
type Route ¶
type Route struct { Method string // e.g. GET Path string // e.g. /app/:id Action string // e.g. "Application.ShowApp", "404" ControllerName string // e.g. "Application", "" MethodName string // e.g. "ShowApp", "" FixedParams []string // e.g. "arg1","arg2","arg3" (CSV formatting) TreePath string // e.g. "/GET/app/:id" TLSOnly bool // contains filtered or unexported fields }
type RouteMatch ¶ added in v0.3.0
type Router ¶ added in v0.3.0
type Router struct { Routes []*Route Tree *pathtree.Node // contains filtered or unexported fields }
func (*Router) Refresh ¶ added in v0.3.0
Refresh re-reads the routes file and re-calculates the routing table. Returns an error if a specified action could not be found.
type Session ¶
type Session struct { SID string Data map[string]interface{} Flash SessFlash `json:"-" bson:"-"` // never save flash Time time.Time Updated time.Time // contains filtered or unexported fields }
func (*Session) DeleteData ¶ added in v0.11.5
func (*Session) GetExpires ¶ added in v0.3.0
func (*Session) RequestURI ¶ added in v0.11.5
type SessionDevNull ¶ added in v0.4.4
type SessionDevNull struct {
// contains filtered or unexported fields
}
func (*SessionDevNull) Cleanup ¶ added in v0.4.4
func (s *SessionDevNull) Cleanup(minTime time.Time)
func (*SessionDevNull) Close ¶ added in v0.4.4
func (s *SessionDevNull) Close()
func (*SessionDevNull) GetSession ¶ added in v0.4.4
func (s *SessionDevNull) GetSession(sid string) (*Session, error)
func (*SessionDevNull) NewSession ¶ added in v0.4.4
func (s *SessionDevNull) NewSession(s2 *Session) error
func (*SessionDevNull) PutSession ¶ added in v0.4.4
func (s *SessionDevNull) PutSession(s2 *Session) error
func (*SessionDevNull) RemoveSession ¶ added in v0.4.4
func (s *SessionDevNull) RemoveSession(s2 *Session) error
func (*SessionDevNull) SetApp ¶ added in v0.4.4
func (s *SessionDevNull) SetApp(app *App)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.