storage

package
v0.0.0-...-0e469d2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultManager = NewManager()

Functions

func CopyDirectory

func CopyDirectory(scrDir, destDir string, srcFs, destFs billy.Filesystem, opts *CopyOptions) error

func CopyFile

func CopyFile(srcFile, dstFile string, srcFs, destFs billy.Filesystem) error
func CopySymLink(source, dest string, srcFs, destFs billy.Filesystem) error

func CreateDirIfNotExists

func CreateDirIfNotExists(dir string, perm os.FileMode, destFs billy.Filesystem) error

func Exists

func Exists(filePath string, destFs billy.Filesystem) bool

func ScanDirectory

func ScanDirectory(srcDir string, srcFs billy.Filesystem, opts *ScanOptions) ([]string, error)

func ScanParent

func ScanParent(srcDir string, srcFs billy.Filesystem, suffix string) (string, error)

Types

type CopyOptions

type CopyOptions struct {
	Ignore []string
}

type GitStorage

type GitStorage struct {
	billy.Filesystem
}

func (GitStorage) Load

func (s GitStorage) Load(path string) (Storage, *StoragePathInfo, error)

func (GitStorage) Save

func (s GitStorage) Save(path string) (Storage, error)

type LocalStorage

type LocalStorage struct {
	billy.Filesystem
}

func (LocalStorage) Load

func (s LocalStorage) Load(path string) (Storage, *StoragePathInfo, error)

func (LocalStorage) Save

func (s LocalStorage) Save(path string) (Storage, error)

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) RegisterStorage

func (m *Manager) RegisterStorage(name string, storage Storage) error

func (*Manager) ResolveStorage

func (m *Manager) ResolveStorage(name string) (Storage, error)

type MemoryStorage

type MemoryStorage struct {
	billy.Filesystem
}

func (MemoryStorage) Load

func (s MemoryStorage) Load(path string) (Storage, *StoragePathInfo, error)

func (MemoryStorage) Save

func (s MemoryStorage) Save(path string) (Storage, error)

type ScanOptions

type ScanOptions struct {
	Ignore             []string
	Suffix             string
	IncludeDirectories bool
	MarkDirectories    bool
	// TODO fix a weird thing (pointer)
	Depth *int
}

type Storage

type Storage interface {
	billy.Filesystem

	Load(path string) (Storage, *StoragePathInfo, error)
	Save(path string) (Storage, error)
}

func NewGit

func NewGit() Storage

func NewLocal

func NewLocal() Storage

func NewMemory

func NewMemory() Storage

type StoragePathInfo

type StoragePathInfo struct {
	Dir        string
	TrimPrefix string
}

func (*StoragePathInfo) Resolve

func (i *StoragePathInfo) Resolve(path string) string

TODO move to another file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL