Documentation ¶
Index ¶
- Constants
- Variables
- func ContextHandle(w http.ResponseWriter, r *http.Request, handler ContextHandler)
- func ContextToRequest(req *http.Request, ctx *Context) *http.Request
- func DefaultPrepareRawDBContext(db *DB) context.Context
- func GetSessionManager(ctx context.Context) session.RequestSessionManager
- func HTTPHandlerOf(handler ContextHandler) http.Handler
- func MapstructureRawGetter2InterfaceGetter(getter getters.Getter, errorcb func(key, value, dest interface{}, err error)) *getters.InterfaceGetterImpl
- func SetSessionManager(parent context.Context, sm session.RequestSessionManager) context.Context
- func SiteMediaHandler(ctx *Context)
- func StringifyError(err error) string
- func StringifyErrorT(ctx i18nmod.Context, err error) string
- type BreadCrumberFunc
- type Breadcrumb
- type BreadcrumbProxy
- type Breadcrumber
- type Breadcrumbs
- type ConfigGetter
- type ConfigSetter
- type ConfigSetterFunc
- type Configor
- type Configors
- type Context
- func (this *Context) Anonymous() bool
- func (this *Context) AsTop() *Context
- func (this *Context) Breadcrumbs() *Breadcrumbs
- func (this *Context) Clone() *Context
- func (this *Context) CloneBasic() *Context
- func (this *Context) CurrentUser() common.User
- func (this *Context) DB(db ...*aorm.DB) *aorm.DB
- func (this *Context) DefaultMediaURL(name string, pth ...string) string
- func (this *Context) DefaultStorageEndpoint() (url string)
- func (this *Context) DelValue(key interface{}) *Context
- func (this *Context) Err() error
- func (this *Context) ErrorResult() Result
- func (this *Context) ErrorT(err error) error
- func (this *Context) ErrorTS(err error) string
- func (this *Context) Flag(key interface{}) bool
- func (this *Context) FlashT(msg interface{}, typ string) (err error)
- func (this *Context) FlashTOrError(msg interface{}, typ string) (ok bool)
- func (this *Context) Get(key interface{}) (interface{}, bool)
- func (this *Context) GetCleanFormattedErrors() (formatedErrors []FormattedError)
- func (this *Context) GetCleanFormattedErrorsOf(errs *Errors) (formatedErrors []FormattedError)
- func (this *Context) GetErrorsT() []error
- func (this *Context) GetErrorsTS() []string
- func (this *Context) GetFormOrQuery(key string) (value string)
- func (this *Context) GetFormattedErrors() (formatedErrors []FormattedError)
- func (this *Context) GetFormattedErrorsOf(errs *Errors) (formatedErrors []FormattedError)
- func (this *Context) GetI18nContext() i18nmod.Context
- func (this *Context) GetLocale() string
- func (this *Context) GetOrDefault(key, defaul interface{}) interface{}
- func (this *Context) GetStaticURL() string
- func (this *Context) GetValue(key interface{}) interface{}
- func (this *Context) Htmlify(value interface{}) template.HTML
- func (this *Context) I18nT(key string) *i18nmod.T
- func (this *Context) IsTop() bool
- func (this *Context) JoinCurrentURL(params ...interface{}) (joinedURL string, err error)
- func (this *Context) JoinPath(path ...string) string
- func (this *Context) JoinStaticURL(path ...string) string
- func (this *Context) JoinURL(url string, params ...interface{}) (joinedURL string, err error)
- func (this *Context) Logger() logging.Logger
- func (this *Context) MediaURL(storageName, name string, pth ...string) string
- func (this *Context) NewChild(r *http.Request, prefix ...string) (*http.Request, *Context)
- func (this *Context) Now() time.Time
- func (this *Context) PatchCurrentURL(params ...interface{}) (patchedURL string, err error)
- func (this *Context) PatchURL(url string, params ...interface{}) (patchedURL string, err error)
- func (this *Context) Path(path ...string) string
- func (this *Context) PopI18nGroup()
- func (this *Context) PushI18nGroup(group string) func()
- func (this *Context) Read(p []byte) (n int, err error)
- func (this *Context) RequestPath() string
- func (this *Context) RequestTime() time.Time
- func (this *Context) Root() *Context
- func (this *Context) SessionManager() session.RequestSessionManager
- func (this *Context) SetCurrentUser(user common.User)
- func (this *Context) SetDB(db *aorm.DB) *Context
- func (this *Context) SetRawDB(db *aorm.DB) *Context
- func (this *Context) SetRequest(r *http.Request)
- func (this *Context) SetRequestTime(requestTime time.Time)
- func (this *Context) SetSessionManager(manager session.RequestSessionManager) *Context
- func (this *Context) SetTimeLocation(timeLocation *time.Location)
- func (this *Context) SetValue(key, value interface{}) *Context
- func (this *Context) StorageEndpoint(storageName string) (url string)
- func (this *Context) T(key string, defaul ...interface{}) template.HTML
- func (this *Context) TT(key string, data interface{}, defaul ...interface{}) template.HTML
- func (this *Context) TTs(key string, data interface{}, defaul ...interface{}) string
- func (this *Context) TimeLocation() *time.Location
- func (this *Context) Top() *Context
- func (this *Context) Ts(key string, defaul ...interface{}) string
- func (this *Context) Tt(o I18nLabelPair) (r template.HTML)
- func (this *Context) TtS(o I18nLabelPair) (r string)
- func (this *Context) URL(pth ...string) string
- func (this *Context) URLParam(key string) string
- func (this *Context) URLParams() *xroute.OrderedMap
- func (this *Context) UserID() aorm.ID
- func (this *Context) Value(key interface{}) interface{}
- func (this Context) WithContext(ctx context.Context) *Context
- func (this Context) WithDB(f func(ctx *Context), db ...*aorm.DB) *Context
- func (this *Context) Write(p []byte) (n int, err error)
- func (this *Context) WsURL(pth ...string) string
- type ContextFactory
- func (cf *ContextFactory) AfterCreate(f ...func(ctx *Context))
- func (cf *ContextFactory) GetOrNewContextFromRequestPair(w http.ResponseWriter, r *http.Request) (*http.Request, *Context)
- func (cf *ContextFactory) NewContextForRequest(req *http.Request, prefix ...string) (*http.Request, *Context)
- func (cf *ContextFactory) NewContextFromRequestPair(w http.ResponseWriter, r *http.Request, prefix ...string) (*http.Request, *Context)
- func (cf *ContextFactory) NewSiteContext(site *Site) *Context
- type ContextGetter
- type ContextHandler
- type ContextHandlerFunc
- type ContextPermissioner
- type ContextProxy
- type ContextStringer
- type Contexts
- func (this Contexts) Append(ctx ...context.Context) Contexts
- func (this Contexts) Deadline() (deadline time.Time, ok bool)
- func (this Contexts) Done() (done <-chan struct{})
- func (this Contexts) Err() (err error)
- func (this Contexts) Prepend(ctx ...context.Context) Contexts
- func (this Contexts) Value(key interface{}) (value interface{})
- type CookiStoreFactory
- type CookieCodec
- type DB
- type DecoderExclude
- type DecoderExcludes
- type DefaultConfigSetter
- type DefaultPermissionDenier
- type Errors
- func (errs *Errors) AddError(errors ...error) error
- func (errs Errors) Error() string
- func (errs Errors) Filter(matcher func(err error) error) Errors
- func (errs Errors) GetErrors() []error
- func (errs Errors) GetErrorsT(ctx i18nmod.Context) (l []error)
- func (errs Errors) GetErrorsTS(ctx i18nmod.Context) (strs []string)
- func (errs Errors) HasError() bool
- func (errs Errors) Len() int
- func (errs *Errors) Reset()
- func (errs Errors) String() string
- func (errs Errors) StringT(ctx i18nmod.Context) string
- type FormOptions
- type FormattedError
- type I18nLabelPair
- type LocalContext
- func (this *LocalContext) BackupValues() func()
- func (this LocalContext) Copy() *LocalContext
- func (this *LocalContext) Deadline() (deadline time.Time, ok bool)
- func (this *LocalContext) Done() <-chan struct{}
- func (this *LocalContext) Err() error
- func (this *LocalContext) Get(key interface{}) (value interface{}, ok bool)
- func (this *LocalContext) GetContext() context.Context
- func (this *LocalContext) SetContext(ctx context.Context)
- func (this *LocalContext) SetValue(key, value interface{}) *LocalContext
- func (this *LocalContext) SetValues(key, value interface{}, pairs ...interface{}) *LocalContext
- func (this *LocalContext) Value(key interface{}) (value interface{})
- func (this LocalContext) WithContext(ctx context.Context) *LocalContext
- type MultipleSiteGetter
- func (this *MultipleSiteGetter) Append(g ...SiteGetter) *MultipleSiteGetter
- func (this MultipleSiteGetter) Get(site *Site, key interface{}) (value interface{}, ok bool)
- func (this MultipleSiteGetter) GetInterface(site *Site, key, dest interface{}) (ok bool)
- func (this *MultipleSiteGetter) Prepend(g ...SiteGetter) *MultipleSiteGetter
- type NameFrame
- type NameStack
- type NameStacker
- type NamedContextHandler
- type NamedContextHandlersRegistrator
- type NamedContextHandlersRegistry
- func (this *NamedContextHandlersRegistry) Add(handler ...*NamedContextHandler)
- func (this *NamedContextHandlersRegistry) Each(cb func(handler *NamedContextHandler) (err error), ...) (err error)
- func (this *NamedContextHandlersRegistry) Get(name string) (f *NamedContextHandler)
- func (this *NamedContextHandlersRegistry) InheritsFrom(registrator ...NamedContextHandlersRegistrator)
- type Option
- type OptionFunc
- type PermissionModeProvider
- type Permissioner
- type PermissionerFunc
- type RawDB
- type RawDBConnectError
- type RecordPermissioner
- type RecordPermissionerFunc
- type Result
- type SentWriterInterface
- type SetupConfig
- type SetupDB
- type SetupOptions
- type Severity
- type Site
- func (this *Site) BasicConfig() *site_config.Config
- func (this *Site) BuildHandler(parent *xroute.Mux) xroute.ContextHandler
- func (this *Site) Config() SiteConfig
- func (this *Site) ConfigSetter() ConfigSetter
- func (this *Site) EachDB(f func(db *DB) error) (err error)
- func (this *Site) GetConfig(key interface{}) (value interface{}, ok bool)
- func (this *Site) GetConfigInterface(key, dest interface{}) (ok bool)
- func (this *Site) GetDB(name string) *DB
- func (this *Site) GetDBOrSystem(name string) *DB
- func (this *Site) GetDefaultMediaStorage() oss.NamedStorageInterface
- func (this *Site) GetMediaStorage(name string) oss.NamedStorageInterface
- func (this *Site) GetMediaStorageOrDefault(name string) oss.NamedStorageInterface
- func (this *Site) GetSystemDB() *DB
- func (this *Site) Handler() xroute.ContextHandler
- func (this *Site) HandlerChanged(f ...func(oldh, newh xroute.ContextHandler))
- func (this *Site) Init(opts *SiteInitOptions) (err error)
- func (this *Site) InitOrPanic(opts *SiteInitOptions) *Site
- func (this *Site) IsRegistered() bool
- func (this *Site) MediaStorages() map[string]oss.NamedStorageInterface
- func (this *Site) MustConfig(key interface{}) (value interface{})
- func (this *Site) Name() string
- func (this *Site) NewContext() *Context
- func (this *Site) OnDestroy(f ...func())
- func (this *Site) PostInit(f ...func())
- func (this *Site) PrepareContext(ctx *Context) *Context
- func (this *Site) PublicURL(p ...string) string
- func (this *Site) PublicURLf(p ...interface{}) string
- func (this *Site) RequestLogger(key string) (fmtr middleware.LogAndPanicFormatter)
- func (this *Site) Role() *roles.Role
- func (this *Site) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (this *Site) ServeHTTPContext(w http.ResponseWriter, r *http.Request, rctx *xroute.RouteContext)
- func (this *Site) SetConfig(key string, value interface{}) (err error)
- func (this *Site) SetConfigSetter(configSetter ConfigSetter)
- func (this *Site) SetHandler(handler xroute.ContextHandler)
- func (this *Site) StorageNames() *oss.Names
- func (this *Site) SystemStorage() *filesystem.FileSystem
- func (this *Site) TextRender(v string) (s string, err error)
- func (this *Site) TimeLocation() *time.Location
- func (this *Site) Title() string
- type SiteConfig
- type SiteConfigSetterFacotry
- type SiteConfigType
- type SiteFactoryCallback
- type SiteGetter
- type SiteGetterImpl
- type SiteInitOptions
- type SitePermissionModeProvider
- type SitesMap
- func (r SitesMap) All() (sites []*Site)
- func (m SitesMap) Copy() (copy SitesMap)
- func (m *SitesMap) Del(key string) (site *Site, err error)
- func (r SitesMap) Each(cb func(site *Site) (err error)) (err error)
- func (r SitesMap) EachOrAll(siteName string, cb func(site *Site) (err error)) error
- func (m SitesMap) Get(key string) (site *Site, ok bool)
- func (r SitesMap) GetOrError(siteName string) (*Site, error)
- func (m SitesMap) Has(key ...string) (ok bool)
- func (r SitesMap) Keys() (keys []string)
- func (m SitesMap) MustGet(key string) (site *Site)
- func (r SitesMap) Names() (names []string)
- func (m *SitesMap) Set(key string, value *Site)
- func (r SitesMap) Sorted() []*Site
- type SitesRegister
- func (this *SitesRegister) Add(site *Site) (err error)
- func (this *SitesRegister) AddHost(siteName, host string) error
- func (this *SitesRegister) AddPath(siteName, path string) error
- func (this *SitesRegister) DelHost(host string) error
- func (this *SitesRegister) DelPath(siteName, path string) error
- func (this *SitesRegister) Destroy() (err error)
- func (this *SitesRegister) DestroySite(name ...string) (err error)
- func (this *SitesRegister) Get(name string) (site *Site, ok bool)
- func (this *SitesRegister) GetByHost(host string) (site *Site, ok bool)
- func (this *SitesRegister) GetByPath(path string) (site *Site, ok bool)
- func (this *SitesRegister) Has(name string) (ok bool)
- func (this *SitesRegister) HasSites() bool
- func (this *SitesRegister) MustGet(name string) (site *Site)
- func (this *SitesRegister) OnAdd(f ...func(site *Site)) *SitesRegister
- func (this *SitesRegister) OnHostAdd(f ...func(site *Site, host string)) *SitesRegister
- func (this *SitesRegister) OnHostDel(f ...func(site *Site, host string)) *SitesRegister
- func (this *SitesRegister) OnPathAdd(f ...func(site *Site, path string)) *SitesRegister
- func (this *SitesRegister) OnPathDel(f ...func(site *Site, path string)) *SitesRegister
- func (this *SitesRegister) OnPostAdd(f ...func(site *Site)) *SitesRegister
- func (this *SitesRegister) OnSetSiteConfigSetterFactory(cb ...func(cb SiteConfigSetterFacotry))
- func (this *SitesRegister) OnSiteDestroy(f ...func(site *Site)) *SitesRegister
- func (this *SitesRegister) Only(name string, f func(site *Site) error) error
- func (this *SitesRegister) Reader() SitesMap
- func (this *SitesRegister) Rename(oldName, newName string) error
- func (this *SitesRegister) SetSiteConfigSetterFactory(siteConfigSetterFactory SiteConfigSetterFacotry)
- func (this *SitesRegister) SetSiteConfigSetterFactoryCallbacks(siteConfigSetterFactoryCallbacks []func(cb SiteConfigSetterFacotry))
- func (this *SitesRegister) Site() *Site
- func (this *SitesRegister) SiteConfigSetterFactory() SiteConfigSetterFacotry
- func (this *SitesRegister) SiteConfigSetterFactoryCallbacks() []func(cb SiteConfigSetterFacotry)
- type StringSlice
Constants ¶
View Source
const ( // ErrCantBeBlank cant blank field ErrCantBeBlank err = "cant be blank" ErrCantBeBlankOneOf err = "cant be blank one of" )
View Source
const PATH_MEDIA = "/!media"
Variables ¶
View Source
var ( StopSiteIteration = errors.New("stop site iteration") StopDBIteration = errors.New("stop db iteration") )
View Source
var ( ErrDuplicateSiteHost = errors.New("duplicate site host") ErrDuplicateSitePath = errors.New("duplicate site path") ErrSiteNotFound = errors.New("site not found") ErrSiteFound = errors.New("site found") )
View Source
var CONTEXT_KEY = PREFIX
View Source
var DefaultLang = "pt"
View Source
var (
DefaultLocale string
)
View Source
var ErrStopIteration = errors.New("stop iteration")
View Source
var Globals = map[interface{}]interface{}{}
View Source
var PREFIX = path_helpers.GetCalledDir()
View Source
var PrepareRawDBContext = DefaultPrepareRawDBContext
Functions ¶
func ContextHandle ¶
func ContextHandle(w http.ResponseWriter, r *http.Request, handler ContextHandler)
func GetSessionManager ¶
func GetSessionManager(ctx context.Context) session.RequestSessionManager
func HTTPHandlerOf ¶
func HTTPHandlerOf(handler ContextHandler) http.Handler
func MapstructureRawGetter2InterfaceGetter ¶
func MapstructureRawGetter2InterfaceGetter(getter getters.Getter, errorcb func(key, value, dest interface{}, err error)) *getters.InterfaceGetterImpl
func SetSessionManager ¶
func SiteMediaHandler ¶
func SiteMediaHandler(ctx *Context)
func StringifyError ¶
Types ¶
type BreadCrumberFunc ¶
type BreadCrumberFunc func(ctx *Context) ([]Breadcrumb, error)
func (BreadCrumberFunc) Breadcrumbs ¶
func (f BreadCrumberFunc) Breadcrumbs(ctx *Context) ([]Breadcrumb, error)
type Breadcrumb ¶
type BreadcrumbProxy ¶
type BreadcrumbProxy struct {
// contains filtered or unexported fields
}
func NewBreadcrumb ¶
func NewBreadcrumb(uri, label string, icon ...string) *BreadcrumbProxy
func (BreadcrumbProxy) Icon ¶
func (b BreadcrumbProxy) Icon() string
func (BreadcrumbProxy) Label ¶
func (b BreadcrumbProxy) Label() string
func (BreadcrumbProxy) URI ¶
func (b BreadcrumbProxy) URI(*Context) string
type Breadcrumber ¶
type Breadcrumber interface {
Breadcrumbs(ctx *Context) (crumbs []Breadcrumb, err error)
}
type Breadcrumbs ¶
type Breadcrumbs struct { Items []Breadcrumb // contains filtered or unexported fields }
func (*Breadcrumbs) AfterNext ¶
func (b *Breadcrumbs) AfterNext(breadcrumbs ...Breadcrumb)
func (*Breadcrumbs) Append ¶
func (b *Breadcrumbs) Append(breadcrumbs ...Breadcrumb)
func (*Breadcrumbs) IsEmpty ¶
func (b *Breadcrumbs) IsEmpty() bool
func (*Breadcrumbs) ItemsWithoutLast ¶
func (b *Breadcrumbs) ItemsWithoutLast() (items []Breadcrumb)
func (*Breadcrumbs) Last ¶
func (b *Breadcrumbs) Last() Breadcrumb
type ConfigGetter ¶
type ConfigSetter ¶
type ConfigSetter interface { Set(key interface{}, value interface{}) (err error) Destroy() }
type ConfigSetterFunc ¶
type ConfigSetterFunc func(key interface{}, value interface{}) (err error)
func (ConfigSetterFunc) Set ¶
func (this ConfigSetterFunc) Set(key interface{}, value interface{}) (err error)
type Configor ¶
type Configor interface { ConfigSet(key, value interface{}) ConfigGet(key interface{}) (value interface{}, ok bool) }
type Context ¶
type Context struct { LocalContext Errors Parent *Context Request *http.Request Writer httpu.ResponseWriter Roles roles.Roles ResourceID aorm.ID ParentResourceID, ExcludeResourceID []aorm.ID Config *site_config.Config I18nContext i18nmod.Context DefaultLocale string Locale string Prefix string StaticURL string Site *Site OriginalURL *url.URL RouteContext *xroute.RouteContext Translator *i18nmod.Translator ContextFactory *ContextFactory I18nGroupStack *i18nGroup Role *roles.Role Lang string LangTag *language.Tag NotFound bool Api bool RedirectTo string MetaTreeStack *NameStacker DecoderExcludes *DecoderExcludes MetaContextFactory func(parent *Context, res interface{}, record interface{}) *Context FormOptions FormOptions // contains filtered or unexported fields }
Context qor context, which is used for many qor components, used to share information between them
func ContextFromDB ¶
func ContextFromRequest ¶
func NewContext ¶
func (*Context) Breadcrumbs ¶
func (this *Context) Breadcrumbs() *Breadcrumbs
func (*Context) CurrentUser ¶
func (*Context) DefaultMediaURL ¶
func (*Context) DefaultStorageEndpoint ¶
func (*Context) ErrorResult ¶
func (*Context) FlashTOrError ¶
func (*Context) GetCleanFormattedErrors ¶
func (this *Context) GetCleanFormattedErrors() (formatedErrors []FormattedError)
func (*Context) GetCleanFormattedErrorsOf ¶
func (this *Context) GetCleanFormattedErrorsOf(errs *Errors) (formatedErrors []FormattedError)
func (*Context) GetErrorsT ¶
func (*Context) GetErrorsTS ¶
func (*Context) GetFormOrQuery ¶
func (*Context) GetFormattedErrors ¶
func (this *Context) GetFormattedErrors() (formatedErrors []FormattedError)
func (*Context) GetFormattedErrorsOf ¶
func (this *Context) GetFormattedErrorsOf(errs *Errors) (formatedErrors []FormattedError)
func (*Context) GetI18nContext ¶
func (*Context) GetOrDefault ¶
func (this *Context) GetOrDefault(key, defaul interface{}) interface{}
func (*Context) GetStaticURL ¶
func (*Context) JoinCurrentURL ¶
JoinCurrentURL is a convinent wrapper for qor/utils.JoinURL
func (*Context) JoinStaticURL ¶
func (*Context) PatchCurrentURL ¶
PatchCurrentURL is a convinent wrapper for qor/utils.PatchURL
func (*Context) PopI18nGroup ¶
func (this *Context) PopI18nGroup()
func (*Context) PushI18nGroup ¶
func (*Context) RequestPath ¶
func (*Context) RequestTime ¶
func (*Context) SessionManager ¶
func (this *Context) SessionManager() session.RequestSessionManager
func (*Context) SetCurrentUser ¶
func (*Context) SetRequest ¶
func (*Context) SetRequestTime ¶
func (*Context) SetSessionManager ¶
func (this *Context) SetSessionManager(manager session.RequestSessionManager) *Context
func (*Context) SetTimeLocation ¶
func (*Context) StorageEndpoint ¶
func (*Context) TimeLocation ¶
func (*Context) TtS ¶
func (this *Context) TtS(o I18nLabelPair) (r string)
func (*Context) URLParams ¶
func (this *Context) URLParams() *xroute.OrderedMap
type ContextFactory ¶
type ContextFactory struct { Translator *i18nmod.Translator // contains filtered or unexported fields }
func NewContextFactory ¶
func NewContextFactory(translator *i18nmod.Translator) *ContextFactory
func (*ContextFactory) AfterCreate ¶
func (cf *ContextFactory) AfterCreate(f ...func(ctx *Context))
func (*ContextFactory) GetOrNewContextFromRequestPair ¶
func (cf *ContextFactory) GetOrNewContextFromRequestPair(w http.ResponseWriter, r *http.Request) (*http.Request, *Context)
func (*ContextFactory) NewContextForRequest ¶
func (*ContextFactory) NewContextFromRequestPair ¶
func (cf *ContextFactory) NewContextFromRequestPair(w http.ResponseWriter, r *http.Request, prefix ...string) (*http.Request, *Context)
func (*ContextFactory) NewSiteContext ¶
func (cf *ContextFactory) NewSiteContext(site *Site) *Context
type ContextGetter ¶
type ContextGetter interface {
GetContext() *Context
}
type ContextHandler ¶
type ContextHandler interface {
ContextHandle(ctx *Context)
}
type ContextHandlerFunc ¶
type ContextHandlerFunc func(ctx *Context)
func (ContextHandlerFunc) ContextHandle ¶
func (this ContextHandlerFunc) ContextHandle(ctx *Context)
type ContextPermissioner ¶
type ContextPermissioner interface {
HasContextPermission(mode roles.PermissionMode, ctx *Context) (perm roles.Perm)
}
type ContextProxy ¶
func (*ContextProxy) Done ¶
func (this *ContextProxy) Done() <-chan struct{}
func (*ContextProxy) Err ¶
func (this *ContextProxy) Err() error
func (*ContextProxy) Get ¶
func (this *ContextProxy) Get(key interface{}) (value interface{}, ok bool)
func (*ContextProxy) Value ¶
func (this *ContextProxy) Value(key interface{}) (value interface{})
type ContextStringer ¶
type CookiStoreFactory ¶
type CookiStoreFactory func(context *Context, options *sessions.Options, codecs *CookieCodec) *sessions.CookieStore
type CookieCodec ¶
type CookieCodec struct {
Codecs []securecookie.Codec
}
type DB ¶
type DB struct { Site *Site Config *dbconfig.DBConfig Name string DB *aorm.DB // contains filtered or unexported fields }
func GetDBFromDB ¶
func (*DB) InitCallback ¶
type DecoderExclude ¶
type DecoderExcludes ¶
type DecoderExcludes struct {
Excludes []DecoderExclude
}
func (*DecoderExcludes) Add ¶
func (this *DecoderExcludes) Add(id aorm.ID, pth string, data interface{})
func (*DecoderExcludes) HasItemOf ¶
func (this *DecoderExcludes) HasItemOf(path string) bool
type DefaultConfigSetter ¶
type DefaultConfigSetter struct { SetterFunc func(key interface{}, value interface{}) (err error) DestroyFunc func() }
func (*DefaultConfigSetter) Destroy ¶
func (this *DefaultConfigSetter) Destroy()
func (*DefaultConfigSetter) Set ¶
func (this *DefaultConfigSetter) Set(key interface{}, value interface{}) (err error)
type DefaultPermissionDenier ¶
type DefaultPermissionDenier interface {
DefaultPermissionDeny() bool
}
type Errors ¶
type Errors []error
Errors is a struct that used to hold errors array
type FormOptions ¶
type FormattedError ¶
type I18nLabelPair ¶
type LocalContext ¶
type LocalContext struct {
// contains filtered or unexported fields
}
func (*LocalContext) BackupValues ¶
func (this *LocalContext) BackupValues() func()
func (LocalContext) Copy ¶
func (this LocalContext) Copy() *LocalContext
func (*LocalContext) Done ¶
func (this *LocalContext) Done() <-chan struct{}
func (*LocalContext) Err ¶
func (this *LocalContext) Err() error
func (*LocalContext) Get ¶
func (this *LocalContext) Get(key interface{}) (value interface{}, ok bool)
func (*LocalContext) GetContext ¶
func (this *LocalContext) GetContext() context.Context
func (*LocalContext) SetContext ¶
func (this *LocalContext) SetContext(ctx context.Context)
func (*LocalContext) SetValue ¶
func (this *LocalContext) SetValue(key, value interface{}) *LocalContext
func (*LocalContext) SetValues ¶
func (this *LocalContext) SetValues(key, value interface{}, pairs ...interface{}) *LocalContext
func (*LocalContext) Value ¶
func (this *LocalContext) Value(key interface{}) (value interface{})
func (LocalContext) WithContext ¶
func (this LocalContext) WithContext(ctx context.Context) *LocalContext
type MultipleSiteGetter ¶
type MultipleSiteGetter []SiteGetter
func (*MultipleSiteGetter) Append ¶
func (this *MultipleSiteGetter) Append(g ...SiteGetter) *MultipleSiteGetter
func (MultipleSiteGetter) Get ¶
func (this MultipleSiteGetter) Get(site *Site, key interface{}) (value interface{}, ok bool)
func (MultipleSiteGetter) GetInterface ¶
func (this MultipleSiteGetter) GetInterface(site *Site, key, dest interface{}) (ok bool)
func (*MultipleSiteGetter) Prepend ¶
func (this *MultipleSiteGetter) Prepend(g ...SiteGetter) *MultipleSiteGetter
type NameStacker ¶
func (NameStacker) String ¶
func (this NameStacker) String() string
func (*NameStacker) WithIndex ¶
func (this *NameStacker) WithIndex(index int, key ...string) func()
func (*NameStacker) WithName ¶
func (this *NameStacker) WithName(name string, key ...string) func()
func (*NameStacker) WithNamer ¶
func (this *NameStacker) WithNamer(f func() string, key ...string) func()
type NamedContextHandler ¶
func GetNamedContextHandlers ¶
func GetNamedContextHandlers(this NamedContextHandlersRegistrator) (handlers []*NamedContextHandler, err error)
func MustGetNamedContextHandlers ¶
func MustGetNamedContextHandlers(this NamedContextHandlersRegistrator) (handlers []*NamedContextHandler, err error)
type NamedContextHandlersRegistrator ¶
type NamedContextHandlersRegistrator interface { InheritsFrom(registrator ...NamedContextHandlersRegistrator) Add(handler ...*NamedContextHandler) Get(name string) *NamedContextHandler Each(cb func(handler *NamedContextHandler) (err error), state ...map[string]*NamedContextHandler) (err error) }
type NamedContextHandlersRegistry ¶
type NamedContextHandlersRegistry struct {
// contains filtered or unexported fields
}
func (*NamedContextHandlersRegistry) Add ¶
func (this *NamedContextHandlersRegistry) Add(handler ...*NamedContextHandler)
func (*NamedContextHandlersRegistry) Each ¶
func (this *NamedContextHandlersRegistry) Each(cb func(handler *NamedContextHandler) (err error), state ...map[string]*NamedContextHandler) (err error)
func (*NamedContextHandlersRegistry) Get ¶
func (this *NamedContextHandlersRegistry) Get(name string) (f *NamedContextHandler)
func (*NamedContextHandlersRegistry) InheritsFrom ¶
func (this *NamedContextHandlersRegistry) InheritsFrom(registrator ...NamedContextHandlersRegistrator)
type OptionFunc ¶
type OptionFunc func(configor Configor)
func (OptionFunc) Apply ¶
func (this OptionFunc) Apply(configor Configor)
type PermissionModeProvider ¶
type Permissioner ¶
type Permissioner interface {
HasPermission(mode roles.PermissionMode, ctx *Context) roles.Perm
}
func AllowedPermissioners ¶
func AllowedPermissioners(p ...Permissioner) Permissioner
func NewPermissioner ¶
func NewPermissioner(f func(mode roles.PermissionMode, ctx *Context) (perm roles.Perm)) Permissioner
func Permissioners ¶
func Permissioners(p ...Permissioner) Permissioner
func RolePermissioner ¶
func RolePermissioner(permissioner roles.Permissioner) Permissioner
type PermissionerFunc ¶
type PermissionerFunc func(mode roles.PermissionMode, ctx *Context) roles.Perm
func (PermissionerFunc) HasPermission ¶
func (f PermissionerFunc) HasPermission(mode roles.PermissionMode, ctx *Context) roles.Perm
type RawDB ¶
type RawDB struct { DB *DB // contains filtered or unexported fields }
func (*RawDB) Do ¶
func (r *RawDB) Do(f func(con db.RawDBConnection))
type RawDBConnectError ¶
type RawDBConnectError struct {
// contains filtered or unexported fields
}
func (*RawDBConnectError) Error ¶
func (r *RawDBConnectError) Error() string
type RecordPermissioner ¶
type RecordPermissioner interface {
HasRecordPermission(mode roles.PermissionMode, ctx *Context, record interface{}) (perm roles.Perm)
}
func NewRecordPermissioner ¶
func NewRecordPermissioner(f func(mode roles.PermissionMode, ctx *Context, record interface{}) (perm roles.Perm)) RecordPermissioner
type RecordPermissionerFunc ¶
type RecordPermissionerFunc func(mode roles.PermissionMode, ctx *Context, record interface{}) roles.Perm
func (RecordPermissionerFunc) HasRecordPermission ¶
func (f RecordPermissionerFunc) HasRecordPermission(mode roles.PermissionMode, ctx *Context, record interface{}) roles.Perm
type SentWriterInterface ¶
type SentWriterInterface interface { http.ResponseWriter Sent() bool }
func SentWriter ¶
func SentWriter(w http.ResponseWriter) SentWriterInterface
type SetupConfig ¶
type SetupConfig struct {
// contains filtered or unexported fields
}
func Setup ¶
func Setup(options SetupOptions) *SetupConfig
func (*SetupConfig) CookieStoreFactory ¶
func (c *SetupConfig) CookieStoreFactory() CookiStoreFactory
func (*SetupConfig) Home ¶
func (c *SetupConfig) Home() string
func (*SetupConfig) IsDev ¶
func (c *SetupConfig) IsDev() bool
func (*SetupConfig) IsProduction ¶
func (c *SetupConfig) IsProduction() bool
func (*SetupConfig) Root ¶
func (c *SetupConfig) Root() string
func (*SetupConfig) TempDir ¶
func (c *SetupConfig) TempDir() string
type SetupOptions ¶
type SetupOptions struct { Home string Root string TempDir string Production bool CookieStoreFactory CookiStoreFactory CookieMaxAge int CookieCodecs []securecookie.Codec }
type Severity ¶
type Severity int
Severity is the severity of the event described in a log entry. These guideline severity levels are ordered, with numerically smaller levels treated as less severe than numerically larger levels.
const ( // Default means the log entry has no assigned severity level. Default Severity = iota // Debug means debug or trace information. Debug // Info means routine information, such as ongoing status or performance. Info // Notice means normal but significant events, such as start up, shut down, or configuration. Notice // Warning means events that might cause problems. Warning // Error means events that are likely to cause problems. Error // Critical means events that cause more severe problems or brief outages. Critical // Alert means a person must take an action immediately. Alert // Emergency means one or more systems are unusable. Emergency )
func ParseSeverity ¶
ParseSeverity returns the Severity whose name equals s, ignoring case. It returns Default if no Severity matches.
func SignToSeverity ¶
type Site ¶
type Site struct { Dbs map[string]*DB Data maps.Map Middlewares xroute.Middlewares Log logging.Logger PermissionModeProvider PermissionModeProvider Mux *xroute.Mux // contains filtered or unexported fields }
func GetSiteFromDB ¶
func GetSiteFromRequest ¶
func NewSite ¶
func NewSite(name string, basicConfig site_config.Config, configGetter getters.InterfaceGetter, cf *ContextFactory) *Site
func (*Site) BasicConfig ¶
func (this *Site) BasicConfig() *site_config.Config
func (*Site) BuildHandler ¶
func (this *Site) BuildHandler(parent *xroute.Mux) xroute.ContextHandler
func (*Site) Config ¶
func (this *Site) Config() SiteConfig
func (*Site) ConfigSetter ¶
func (this *Site) ConfigSetter() ConfigSetter
func (*Site) GetConfigInterface ¶
func (*Site) GetDBOrSystem ¶
func (*Site) GetDefaultMediaStorage ¶
func (this *Site) GetDefaultMediaStorage() oss.NamedStorageInterface
func (*Site) GetMediaStorage ¶
func (this *Site) GetMediaStorage(name string) oss.NamedStorageInterface
func (*Site) GetMediaStorageOrDefault ¶
func (this *Site) GetMediaStorageOrDefault(name string) oss.NamedStorageInterface
func (*Site) GetSystemDB ¶
func (*Site) Handler ¶
func (this *Site) Handler() xroute.ContextHandler
func (*Site) HandlerChanged ¶
func (this *Site) HandlerChanged(f ...func(oldh, newh xroute.ContextHandler))
func (*Site) Init ¶
func (this *Site) Init(opts *SiteInitOptions) (err error)
func (*Site) InitOrPanic ¶
func (this *Site) InitOrPanic(opts *SiteInitOptions) *Site
func (*Site) IsRegistered ¶
func (*Site) MediaStorages ¶
func (this *Site) MediaStorages() map[string]oss.NamedStorageInterface
func (*Site) MustConfig ¶
func (this *Site) MustConfig(key interface{}) (value interface{})
func (*Site) NewContext ¶
func (*Site) PrepareContext ¶
func (*Site) PublicURLf ¶
func (*Site) RequestLogger ¶
func (this *Site) RequestLogger(key string) (fmtr middleware.LogAndPanicFormatter)
func (*Site) ServeHTTPContext ¶
func (this *Site) ServeHTTPContext(w http.ResponseWriter, r *http.Request, rctx *xroute.RouteContext)
func (*Site) SetConfigSetter ¶
func (this *Site) SetConfigSetter(configSetter ConfigSetter)
func (*Site) SetHandler ¶
func (this *Site) SetHandler(handler xroute.ContextHandler)
func (*Site) StorageNames ¶
func (*Site) SystemStorage ¶
func (this *Site) SystemStorage() *filesystem.FileSystem
func (*Site) TimeLocation ¶
type SiteConfig ¶
type SiteConfig interface { ConfigGetter ConfigSetter }
type SiteConfigSetterFacotry ¶
type SiteConfigSetterFacotry interface { Factory(site *Site) (setter ConfigSetter) FactoryCallback(cb ...*SiteFactoryCallback) }
type SiteConfigType ¶
type SiteConfigType uint8
const ( SiteConfigBasic SiteConfigType = iota SiteConfigContextFactory SiteInitOptionsKey = "core:site_init_options" )
type SiteFactoryCallback ¶
type SiteFactoryCallback struct { Setup func(site *Site, setter ConfigSetter) Destroy func(site *Site) }
type SiteGetter ¶
type SiteGetter interface { Get(site *Site, key interface{}) (value interface{}, ok bool) GetInterface(site *Site, key, dest interface{}) (ok bool) }
func NewSiteGetter ¶
func NewSiteGetter(getter func(site *Site, key interface{}) (value interface{}, ok bool), ifGetter func(site *Site, key, dest interface{}) (ok bool)) SiteGetter
type SiteGetterImpl ¶
type SiteGetterImpl struct { GetFunc func(site *Site, key interface{}) (value interface{}, ok bool) GetInterfaceFunc func(site *Site, key, dest interface{}) (ok bool) }
func (*SiteGetterImpl) Get ¶
func (f *SiteGetterImpl) Get(site *Site, key interface{}) (value interface{}, ok bool)
func (*SiteGetterImpl) GetInterface ¶
func (f *SiteGetterImpl) GetInterface(site *Site, key, dest interface{}) (ok bool)
type SiteInitOptions ¶
type SiteInitOptions struct {
DBAutoConnectDisabled bool
}
type SitePermissionModeProvider ¶
type SitePermissionModeProvider struct { Site *Site Std func() roles.Roles Default func() roles.Roles }
func (SitePermissionModeProvider) Provides ¶
func (this SitePermissionModeProvider) Provides() (modes roles.Roles)
type SitesRegister ¶
type SitesRegister struct { Alone bool ByName SitesMap ByHost SitesMap ByPath SitesMap AddedCallbacks []func(site *Site) PostAddedCallbacks []func(site *Site) DeletedCallbacks []func(site *Site) HostAddedCallbacks []func(site *Site, host string) HostDeletedCallbacks []func(site *Site, host string) PathAddedCallbacks []func(site *Site, pth string) PathDeletedCallbacks []func(site *Site, pth string) SiteConfigGetter MultipleSiteGetter // contains filtered or unexported fields }
func (*SitesRegister) Add ¶
func (this *SitesRegister) Add(site *Site) (err error)
func (*SitesRegister) AddHost ¶
func (this *SitesRegister) AddHost(siteName, host string) error
func (*SitesRegister) AddPath ¶
func (this *SitesRegister) AddPath(siteName, path string) error
func (*SitesRegister) DelHost ¶
func (this *SitesRegister) DelHost(host string) error
func (*SitesRegister) DelPath ¶
func (this *SitesRegister) DelPath(siteName, path string) error
func (*SitesRegister) Destroy ¶
func (this *SitesRegister) Destroy() (err error)
func (*SitesRegister) DestroySite ¶
func (this *SitesRegister) DestroySite(name ...string) (err error)
func (*SitesRegister) GetByHost ¶
func (this *SitesRegister) GetByHost(host string) (site *Site, ok bool)
func (*SitesRegister) GetByPath ¶
func (this *SitesRegister) GetByPath(path string) (site *Site, ok bool)
func (*SitesRegister) Has ¶
func (this *SitesRegister) Has(name string) (ok bool)
func (*SitesRegister) HasSites ¶
func (this *SitesRegister) HasSites() bool
func (*SitesRegister) MustGet ¶
func (this *SitesRegister) MustGet(name string) (site *Site)
func (*SitesRegister) OnAdd ¶
func (this *SitesRegister) OnAdd(f ...func(site *Site)) *SitesRegister
func (*SitesRegister) OnHostAdd ¶
func (this *SitesRegister) OnHostAdd(f ...func(site *Site, host string)) *SitesRegister
func (*SitesRegister) OnHostDel ¶
func (this *SitesRegister) OnHostDel(f ...func(site *Site, host string)) *SitesRegister
func (*SitesRegister) OnPathAdd ¶
func (this *SitesRegister) OnPathAdd(f ...func(site *Site, path string)) *SitesRegister
func (*SitesRegister) OnPathDel ¶
func (this *SitesRegister) OnPathDel(f ...func(site *Site, path string)) *SitesRegister
func (*SitesRegister) OnPostAdd ¶
func (this *SitesRegister) OnPostAdd(f ...func(site *Site)) *SitesRegister
func (*SitesRegister) OnSetSiteConfigSetterFactory ¶
func (this *SitesRegister) OnSetSiteConfigSetterFactory(cb ...func(cb SiteConfigSetterFacotry))
func (*SitesRegister) OnSiteDestroy ¶
func (this *SitesRegister) OnSiteDestroy(f ...func(site *Site)) *SitesRegister
func (*SitesRegister) Only ¶
func (this *SitesRegister) Only(name string, f func(site *Site) error) error
func (*SitesRegister) Reader ¶
func (this *SitesRegister) Reader() SitesMap
func (*SitesRegister) Rename ¶
func (this *SitesRegister) Rename(oldName, newName string) error
func (*SitesRegister) SetSiteConfigSetterFactory ¶
func (this *SitesRegister) SetSiteConfigSetterFactory(siteConfigSetterFactory SiteConfigSetterFacotry)
func (*SitesRegister) SetSiteConfigSetterFactoryCallbacks ¶
func (this *SitesRegister) SetSiteConfigSetterFactoryCallbacks(siteConfigSetterFactoryCallbacks []func(cb SiteConfigSetterFacotry))
func (*SitesRegister) Site ¶
func (this *SitesRegister) Site() *Site
func (*SitesRegister) SiteConfigSetterFactory ¶
func (this *SitesRegister) SiteConfigSetterFactory() SiteConfigSetterFacotry
func (*SitesRegister) SiteConfigSetterFactoryCallbacks ¶
func (this *SitesRegister) SiteConfigSetterFactoryCallbacks() []func(cb SiteConfigSetterFacotry)
type StringSlice ¶
type StringSlice []string
func (StringSlice) Has ¶
func (this StringSlice) Has(v string) bool
func (StringSlice) Interfaces ¶
func (this StringSlice) Interfaces() []interface{}
Source Files ¶
- breadcrumb.go
- configor.go
- context.go
- context_errors.go
- context_factory.go
- context_handler.go
- context_helpers.go
- context_media.go
- context_named_handler.go
- context_proxy.go
- context_translation.go
- contexts.go
- core.go
- db.go
- errors.go
- globals.go
- i18n.go
- io.go
- media.go
- name_stack.go
- permission.go
- permissioner.go
- prefix.go
- roles.go
- session.go
- setup.go
- severity.go
- site.go
- site_logger.go
- siteconfig.go
- sitegetter.go
- sites.go
- sitesmap.go
- sitesregister.go
- stringer.go
Click to show internal directories.
Click to hide internal directories.