Documentation ¶
Index ¶
- func GraphQLHandler() http.Handler
- func QuerySort(sortq string, files []os.FileInfo) (err error)
- func ServeAPI(path string, root http.FileSystem) midway.Middleware
- func SortBy(by string, files []os.FileInfo) (s sort.Interface, err error)
- type ByModTime
- type ByName
- type ByType
- type DirStat
- type FileInfo
- type FileStat
- type Link
- type StatError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GraphQLHandler ¶
GraphQLHandler returns http.Handler for the graphql endpoint
func ServeAPI ¶
func ServeAPI(path string, root http.FileSystem) midway.Middleware
ServeAPI generates a middleware to serve API for file / directory information query
Types ¶
type ByModTime ¶
ByModTime sorts []os.FileInfo by the ModTime() results
type ByName ¶
ByName sorts []os.FileInfo by Name() results
type ByType ¶
ByType sorts directory before files in []os.FileInfo
type DirStat ¶
DirStat stores and display a directory's information as JSON
func (DirStat) MarshalJSON ¶
MarshalJSON implements encoding/json.Marshaler
type FileInfo ¶
type FileInfo struct { Name string `json:"name"` Path string `json:"path,omitempty"` Type string `json:"type"` Mime string `json:"mime,omitempty"` HasIndex bool `json:"hasIndex,omitempty"` Size int64 `json:"size,omitempty"` MTime time.Time `json:"mtime,omitempty"` Links []Link `json:"links,omitempty"` }
FileInfo is a JSON display of a subset of os.FileInfo information
type FileStat ¶
FileStat stores and display a file's information as JSON
func (FileStat) MarshalJSON ¶
MarshalJSON implements encoding/json.Marshaler
type StatError ¶
StatError represents an error in JSON format
func NewStatError ¶
NewStatError returns a new StatError
func (StatError) MarshalJSON ¶
MarshalJSON implements encoding/json.Marshaler