Documentation ¶
Index ¶
- Variables
- func Equal(a, b interface{}) bool
- func RegisterViewPath(path string) error
- type Action
- type Admin
- func (admin *Admin) AddMenu(menu *Menu)
- func (admin *Admin) AddResource(value interface{}, config *Config) *Resource
- func (admin Admin) GetMenu(name string) (m *Menu)
- func (admin Admin) GetMenus() []*Menu
- func (admin *Admin) GetResource(name string) *Resource
- func (admin *Admin) GetRouter() *Router
- func (admin *Admin) MountTo(prefix string, mux *http.ServeMux)
- func (admin *Admin) NewContext(w http.ResponseWriter, r *http.Request) *Context
- func (admin *Admin) RegisterFuncMap(name string, fc interface{})
- func (admin *Admin) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (admin *Admin) SetAuth(auth Auth)
- type AssetManager
- type Auth
- type Config
- type Context
- func (context *Context) AllMetas(resources ...*Resource) []*Meta
- func (context *Context) EditMetas(resources ...*Resource) []*Meta
- func (context *Context) Execute(name string, result interface{})
- func (context *Context) HasPrimaryKey(value interface{}, primaryKey interface{}) bool
- func (context *Context) IndexMetas(resources ...*Resource) []*Meta
- func (context *Context) JavaScriptTag(name string) string
- func (context *Context) LinkTo(text interface{}, link interface{}) string
- func (context *Context) NewMetas(resources ...*Resource) []*Meta
- func (context *Context) NewRecord(value interface{}) interface{}
- func (context *Context) NewResource(name ...string) *Context
- func (context *Context) NewResourcePath(value interface{}) string
- func (context *Context) PrimaryKeyOf(value interface{}) interface{}
- func (context *Context) Render(name string, results ...interface{}) string
- func (context *Context) RenderForm(value interface{}, metas []*Meta) string
- func (context *Context) RenderMeta(writer *bytes.Buffer, meta *Meta, value interface{}, prefix []string)
- func (context *Context) ResourcePath() string
- func (context *Context) SetResource(res *Resource) *Context
- func (context *Context) ShowMetas(resources ...*Resource) []*Meta
- func (context *Context) StyleSheetTag(name string) string
- func (context *Context) UrlFor(value interface{}, resources ...*Resource) string
- func (context *Context) ValueOf(value interface{}, meta *Meta) interface{}
- type Filter
- type Handle
- type Handler
- type Injector
- type Menu
- type Meta
- func (meta *Meta) GetFieldName() string
- func (meta *Meta) GetMetas() []resource.Metaor
- func (meta *Meta) GetName() string
- func (meta *Meta) GetResource() resource.Resourcer
- func (meta *Meta) GetSetter() ...
- func (meta *Meta) GetValuer() func(interface{}, *qor.Context) interface{}
- func (meta *Meta) HasPermission(mode roles.PermissionMode, context *qor.Context) bool
- type Resource
- func (res *Resource) Action(action *Action)
- func (res *Resource) AllMetas() []*Meta
- func (res *Resource) AllowedMetas(attrs []*Meta, context *Context, roles ...roles.PermissionMode) []*Meta
- func (res *Resource) CallFinder(result interface{}, metaValues *resource.MetaValues, context *qor.Context) error
- func (res *Resource) CallSaver(result interface{}, context *qor.Context) error
- func (res *Resource) CallSearcher(result interface{}, context *qor.Context) error
- func (res *Resource) ConvertObjectToMap(context qor.Contextor, value interface{}, metas []*Meta) interface{}
- func (res *Resource) Decode(contextor qor.Contextor, value interface{}) (errs []error)
- func (res *Resource) EditAttrs(columns ...string)
- func (res *Resource) EditMetas() []*Meta
- func (res *Resource) Filter(filter *Filter)
- func (res Resource) GetAdmin() *Admin
- func (res *Resource) GetMetas(_attrs ...[]string) []resource.Metaor
- func (res *Resource) IndexAttrs(columns ...string)
- func (res *Resource) IndexMetas() []*Meta
- func (res *Resource) Meta(meta *Meta)
- func (res *Resource) NewAttrs(columns ...string)
- func (res *Resource) NewMetas() []*Meta
- func (res *Resource) Scope(scope *Scope)
- func (res *Resource) ShowAttrs(columns ...string)
- func (res *Resource) ShowMetas() []*Meta
- func (res Resource) ToParam() string
- type ResourceNamer
- type Router
- type Scope
- type Searcher
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHandler = func(name string, value string, scope *gorm.DB, context *qor.Context) *gorm.DB { lastIndex := strings.LastIndex(name, "_") operation := name[lastIndex+1 : len(name)] column := name[0:lastIndex] switch operation { case "cont": return scope.Where(fmt.Sprintf("%v ILIKE ?", scope.NewScope(nil).Quote(column)), "%"+value+"%") case "eq": return scope.Where(fmt.Sprintf("%v = ?", scope.NewScope(nil).Quote(column)), value) case "gt": return scope.Where(fmt.Sprintf("%v > ?", scope.NewScope(nil).Quote(column)), value) case "gteq": return scope.Where(fmt.Sprintf("%v >= ?", scope.NewScope(nil).Quote(column)), value) case "lt": return scope.Where(fmt.Sprintf("%v < ?", scope.NewScope(nil).Quote(column)), value) case "lteq": return scope.Where(fmt.Sprintf("%v <= ?", scope.NewScope(nil).Quote(column)), value) } return scope }
View Source
var DisableLogging bool
View Source
var Root, _ = os.Getwd()
Functions ¶
func RegisterViewPath ¶
Types ¶
type Admin ¶
func (*Admin) AddResource ¶
func (*Admin) GetResource ¶
func (*Admin) NewContext ¶
func (*Admin) RegisterFuncMap ¶
type AssetManager ¶
type AssetManager struct { ID int File media_library.FileSystem `media_library:"URL:/system/assets/{{primary_key}}/{{filename_with_hash}}"` }
func (*AssetManager) InjectQorAdmin ¶
func (*AssetManager) InjectQorAdmin(res *Resource)
type Auth ¶
type Auth interface { GetCurrentUser(*Context) qor.CurrentUser Login(*Context) Logout(*Context) }
type Context ¶
type Context struct { *qor.Context *Searcher Resource *Resource Admin *Admin CurrentUser qor.CurrentUser Writer http.ResponseWriter Result interface{} Content string }
func (*Context) HasPrimaryKey ¶
func (*Context) IndexMetas ¶
func (*Context) JavaScriptTag ¶
func (*Context) NewResource ¶
func (*Context) NewResourcePath ¶
func (*Context) PrimaryKeyOf ¶
func (context *Context) PrimaryKeyOf(value interface{}) interface{}
Function Maps
func (*Context) RenderForm ¶
func (*Context) RenderMeta ¶
func (*Context) SetResource ¶
func (*Context) StyleSheetTag ¶
type Menu ¶
type Meta ¶
type Meta struct { Name string Alias string Label string Type string Valuer func(interface{}, *qor.Context) interface{} // TODO: should allow Setter to return error, at least have a place to register Setter func(resource interface{}, metaValue *resource.MetaValue, context *qor.Context) Metas []resource.Metaor Resource resource.Resourcer Collection interface{} GetCollection func(interface{}, *qor.Context) [][]string Permission *roles.Permission // contains filtered or unexported fields }
func (*Meta) GetFieldName ¶
func (*Meta) GetResource ¶
func (*Meta) HasPermission ¶
type Resource ¶
type Resource struct { resource.Resource Config *Config Metas []*Meta // contains filtered or unexported fields }
func (*Resource) AllowedMetas ¶
func (*Resource) CallFinder ¶
func (*Resource) CallSearcher ¶
func (*Resource) ConvertObjectToMap ¶
func (*Resource) IndexAttrs ¶
func (*Resource) IndexMetas ¶
type ResourceNamer ¶
type ResourceNamer interface {
ResourceName() string
}
Click to show internal directories.
Click to hide internal directories.