Documentation
¶
Index ¶
- Variables
- func DefaultGetRoutePath(r *http.Request) string
- func DefaultSetDirectory(ctx context.Context, dir Directory) context.Context
- func DefaultSetResource(ctx context.Context, res Resource) context.Context
- type CreatableResource
- type DeletableResource
- type Directory
- type PeekableResource
- type Resource
- type Server
- type SubmitableResource
- type User
- type UserCapability
- type View
- type ViewConfig
- func (c *ViewConfig) SetDefaults() error
- func (c *ViewConfig) SetEditHandler(path string, handler web.HandlerFunc) error
- func (c *ViewConfig) SetErrorHandler(f web.ErrorHandlerFunc) error
- func (c *ViewConfig) SetFilesHandler(path string, handler web.HandlerFunc) error
- func (c *ViewConfig) SetGetDirectory(f func(ctx context.Context) Directory) error
- func (c *ViewConfig) SetGetResource(f func(ctx context.Context) Resource) error
- func (c *ViewConfig) SetGetRoutePath(f func(*http.Request) string) error
- func (c *ViewConfig) SetGetUser(f func(ctx context.Context) User) error
- func (c *ViewConfig) SetIndexPage(index string) error
- func (c *ViewConfig) SetPingHandler(path string, handler web.HandlerFunc) error
- func (c *ViewConfig) SetSetDirectory(f func(ctx context.Context, res Directory) context.Context) error
- func (c *ViewConfig) SetSetResource(f func(ctx context.Context, res Resource) context.Context) error
- func (c *ViewConfig) SetSitemapHandler(path string, handler web.HandlerFunc) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ResourceCtxKey = &contextKey{"Resource"} DirectoryCtxKey = &contextKey{"Directory"} )
Functions ¶
func DefaultGetRoutePath ¶ added in v0.5.0
func DefaultSetDirectory ¶ added in v0.7.0
Types ¶
type CreatableResource ¶
PUT
type DeletableResource ¶
DELETE
type Directory ¶ added in v0.0.6
type Directory interface {
fs.DirEntry
fs.FileInfo
Path() string
Chdir(string) (Directory, error)
MkdirAll(string) (Directory, error)
Open(string) (Resource, error)
}
func DefaultGetDirectory ¶ added in v0.7.0
type PeekableResource ¶
HEAD
type SubmitableResource ¶
POST
type User ¶ added in v0.0.2
type User interface {
Username() string
CanDo(c UserCapability, r Resource) bool
CanDoPath(c UserCapability, path string) bool
}
func DefaultGetUser ¶ added in v0.5.0
type UserCapability ¶ added in v0.0.2
type UserCapability int
const ( CanRead UserCapability = iota CanWrite CanPurge )
type ViewConfig ¶ added in v0.0.2
type ViewConfig struct {
GetRoutePath func(r *http.Request) string
GetUser func(ctx context.Context) User
SetResource func(ctx context.Context, res Resource) context.Context
GetResource func(ctx context.Context) Resource
SetDirectory func(ctx context.Context, res Directory) context.Context
GetDirectory func(ctx context.Context) Directory
Edit string // per resource
EditHandler web.HandlerFunc
Files string // per directory
FilesHandler web.HandlerFunc
Ping string // optional per view
PingHandler web.HandlerFunc
Sitemap string // optional per view
SitemapHandler web.HandlerFunc
ErrorHandler web.ErrorHandlerFunc
Index string // default page
ReadOnly bool // storage can't be modified through this View
}
func (*ViewConfig) SetEditHandler ¶ added in v0.0.3
func (c *ViewConfig) SetEditHandler(path string, handler web.HandlerFunc) error
Set View's File Editor
func (*ViewConfig) SetErrorHandler ¶ added in v0.5.0
func (c *ViewConfig) SetErrorHandler(f web.ErrorHandlerFunc) error
func (*ViewConfig) SetFilesHandler ¶ added in v0.0.3
func (c *ViewConfig) SetFilesHandler(path string, handler web.HandlerFunc) error
Set View's File Manager
func (*ViewConfig) SetGetDirectory ¶ added in v0.7.0
func (c *ViewConfig) SetGetDirectory(f func(ctx context.Context) Directory) error
Get Directory from context.Context
func (*ViewConfig) SetGetResource ¶ added in v0.5.0
func (c *ViewConfig) SetGetResource(f func(ctx context.Context) Resource) error
Get Resource from context.Context
func (*ViewConfig) SetGetRoutePath ¶ added in v0.5.0
func (c *ViewConfig) SetGetRoutePath(f func(*http.Request) string) error
func (*ViewConfig) SetGetUser ¶ added in v0.5.0
func (c *ViewConfig) SetGetUser(f func(ctx context.Context) User) error
func (*ViewConfig) SetIndexPage ¶ added in v0.5.0
func (c *ViewConfig) SetIndexPage(index string) error
func (*ViewConfig) SetPingHandler ¶ added in v0.0.3
func (c *ViewConfig) SetPingHandler(path string, handler web.HandlerFunc) error
Set View's Ping Handler
func (*ViewConfig) SetSetDirectory ¶ added in v0.7.0
func (c *ViewConfig) SetSetDirectory(f func(ctx context.Context, res Directory) context.Context) error
Put Directory into context.Context
func (*ViewConfig) SetSetResource ¶ added in v0.5.0
func (c *ViewConfig) SetSetResource(f func(ctx context.Context, res Resource) context.Context) error
Put Resource into context.Context
func (*ViewConfig) SetSitemapHandler ¶ added in v0.0.3
func (c *ViewConfig) SetSitemapHandler(path string, handler web.HandlerFunc) error
Set View's Sitemap Handler
Click to show internal directories.
Click to hide internal directories.