Documentation
¶
Overview ¶
Package versioner implements common interfaces for file versioning and a simple default versioning scheme.
Index ¶
- Constants
- Variables
- func ExtractTag(path string) string
- func TagFilename(name, tag string) string
- func UntagFilename(path string) (string, string)
- type External
- type FileVersion
- type Interval
- type Simple
- type Staggered
- type Trashcan
- type Versioner
- func NewExternal(folderID string, filesystem fs.Filesystem, params map[string]string) Versioner
- func NewSimple(folderID string, folderFs fs.Filesystem, params map[string]string) Versioner
- func NewStaggered(folderID string, folderFs fs.Filesystem, params map[string]string) Versioner
- func NewTrashcan(folderID string, folderFs fs.Filesystem, params map[string]string) Versioner
Constants ¶
const ( TimeFormat = "20060102-150405" TimeGlob = "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9]" // glob pattern matching TimeFormat )
Variables ¶
var ErrRestorationNotSupported = fmt.Errorf("version restoration not supported with the current versioner")
var Factories = map[string]func(folderID string, filesystem fs.Filesystem, params map[string]string) Versioner{}
Functions ¶
func ExtractTag ¶ added in v0.14.44
Returns the tag from a filename, whether at the end or middle.
func TagFilename ¶ added in v0.14.44
Inserts ~tag just before the extension of the filename.
func UntagFilename ¶ added in v0.14.44
Types ¶
type External ¶
type External struct {
// contains filtered or unexported fields
}
func (External) Archive ¶
Archive moves the named file away to a version archive. If this function returns nil, the named file does not exist any more (has been archived).
func (External) GetVersions ¶ added in v1.1.4
func (v External) GetVersions() (map[string][]FileVersion, error)
type FileVersion ¶ added in v0.14.44
type Simple ¶
type Simple struct {
// contains filtered or unexported fields
}
func (Simple) Archive ¶
Archive moves the named file away to a version archive. If this function returns nil, the named file does not exist any more (has been archived).
func (Simple) GetVersions ¶ added in v1.1.4
func (v Simple) GetVersions() (map[string][]FileVersion, error)
type Staggered ¶
func (*Staggered) Archive ¶
Archive moves the named file away to a version archive. If this function returns nil, the named file does not exist any more (has been archived).
func (*Staggered) GetVersions ¶ added in v1.1.4
func (v *Staggered) GetVersions() (map[string][]FileVersion, error)
type Trashcan ¶
func (*Trashcan) Archive ¶
Archive moves the named file away to a version archive. If this function returns nil, the named file does not exist any more (has been archived).
func (*Trashcan) GetVersions ¶ added in v1.1.4
func (t *Trashcan) GetVersions() (map[string][]FileVersion, error)
type Versioner ¶
type Versioner interface { Archive(filePath string) error GetVersions() (map[string][]FileVersion, error) Restore(filePath string, versionTime time.Time) error }