Documentation ¶
Index ¶
- Variables
- type CBFile
- type CBPath
- type FileEntry
- type FileHandler
- type FileSpec
- type Handlers
- type Model
- type PathEntry
- func (p *PathEntry) Info()
- func (p *PathEntry) IsIgnore(r *Model) bool
- func (p *PathEntry) Refresh(model *Model, counter *(int32), handler *Handlers)
- func (p *PathEntry) RefreshCB(rootPathEntry *Model, counter *(int32), cbPath *CBPath, cbFile *CBFile)
- func (p *PathEntry) Review(mRoot *Model, cbPath *CBPath, cbFile *CBFile)
- func (p *PathEntry) Top() *PathEntry
- type PathHandler
- type PathSpec
- type Settings
- type SimpleModel
Constants ¶
This section is empty.
Variables ¶
var ( DefaultSettings = Settings{ OmitRootNameFromPath: false, StripFileExtensionFromName: true, UnknownCharsToDash: false, HardLinks: false, } )
Default Settings
Functions ¶
This section is empty.
Types ¶
type CBFile ¶
CBFile is a simple callback if you return true, then the caller function immediately returns.
type CBPath ¶
CBPath is a simple callback; if you return true, then the caller function immediately returns.
type FileEntry ¶
type FileEntry struct { Parent *PathEntry `json:"-"` // Parent directory Name string `json:"name,omitempty"` // FullPath string `json:"-"` // Complete directory path SHA1 string `json:"sha1,omitempty"` Path string `json:"path,omitempty"` Extension string `json:"ext,omitempty"` Mod time.Time `json:"mod"` }
FileEntry ...
func (*FileEntry) Rooted ¶
Rooted returns the FileEntry.FullPath excluding the full root-path with exception to the root-directory name. It applies `Settings.OmitRootNameFromPath`.
func (*FileEntry) RootedPath ¶
RootedPath applies additional filtering on `FileEntry` such as `Settings.UnknownCharsToDash` and `Settings.OmitRootNameFromPath`.
type Handlers ¶
type Handlers struct { ChildPath PathHandler ChildFile FileHandler }
Handlers contains simple callbacks.
type Model ¶
type Model struct { PathEntry IgnorePaths []string `json:"ignore,omitempty"` SimpleModel `json:"-"` Settings `json:"-"` }
Model is the same as PathEntry but with Settings
type PathEntry ¶
type PathEntry struct { PathSpec FileFilter []FileSpec `json:"-"` Index int32 `json:"id"` // FauxPath is only set on the root item and is // used to portray a URI from a relative path. FauxPath string `json:"uri,omitempty"` }
PathEntry ...
func (*PathEntry) IsIgnore ¶
IsIgnore is a case sensitive string matcher checking each path added to our index with a unix slash `/` path separator. We'll check against abspath, path name
func (*PathEntry) Refresh ¶
Refresh refreshes child directories and files. parameter `rootPathEntry`: root-path entry. parameter `counter (*int32)`: pointer to our indexing integer (counter). parameter `callback (RefreshAction)` is a method (if defined) which
can be used arbitrarily.
func (*PathEntry) RefreshCB ¶
func (p *PathEntry) RefreshCB(rootPathEntry *Model, counter *(int32), cbPath *CBPath, cbFile *CBFile)
RefreshCB refreshes child directories and files. parameter `rootPathEntry`: root-path entry. parameter `counter (*int32)`: pointer to our indexing integer (counter). parameter `callback (RefreshAction)` is a method (if defined) which
can be used arbitrarily.
Only difference here is that we're using CBPath and CBFile as opposed to a Handlers structure which contains callbacks for our `Refresh(…)`.
type PathSpec ¶
type PathSpec struct { FileEntry // Indicates a top-level directory IsRoot bool `json:"-"` // Child items Paths []PathEntry `json:"paths,omitempty"` Files []FileEntry `json:"files,omitempty"` }
PathSpec has to have a comment so there it is.
This structure is basis for file/directory navigation wrapping folder/file structure in memory.
type Settings ¶
type Settings struct { // OmitRootNameFromPath will strip the root directory-name from indexed path targets. // Only the default value of false is currently known to be working. // For example if true, a path converted to "http path": path-in: "c:/mypath/mysubdir/my-target-path", path-out: "/". // If set to (default) false: path-in: "c:/mypath/mysubdir/my-target-path", path-out: "/my-target-path". OmitRootNameFromPath bool `json:"omit-root"` StripFileExtensionFromName bool `json:"strip-file-ext,omitempty"` // since default=true: "opmitempty". UnknownCharsToDash bool `json:"space2dash,omitempty"` // not uet supported. HardLinks bool `json:"hard-link"` // this tells us weather or not to use full link-path such as `http://[server:port]/` when generating JSON. }
Settings will slightly alter how the `Refresh` method runs. Eventually, we'll convert this to flag-usage in the console client.
type SimpleModel ¶
type SimpleModel struct { File map[string]*FileEntry FileSHA1 map[string]*FileEntry Path map[string]*PathEntry PathSHA1 map[string]*PathEntry }
SimpleModel collects our indexes
func (*SimpleModel) AddFile ¶
func (m *SimpleModel) AddFile(p *Model, c *FileEntry)
AddFile is a callback per FileEntry. It adds each FileEntry to a flat (non-hierarchical) map (dictionary).
func (*SimpleModel) AddPath ¶
func (m *SimpleModel) AddPath(p *Model, c *PathEntry)
AddPath is a callback per PathEntry. It adds each PathEntry to a flat (non-hierarchical) map (dictionary).
func (*SimpleModel) CreateMaps ¶
func (m *SimpleModel) CreateMaps()
CreateMaps makes a new data-set.
func (*SimpleModel) ResetMaps ¶
func (m *SimpleModel) ResetMaps()
ResetMaps destroys all top level items (if hierarchical) in the maps.