assetfsapi

package
v0.0.0-...-e34a27c Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 13 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetCompilerInterface

type AssetCompilerInterface interface {
	Compile() error
}

type AssetGetterInterface

type AssetGetterInterface interface {
	Asset(path string) (AssetInterface, error)
	AssetC(ctx context.Context, path string) (asset AssetInterface, err error)
	MustAsset(path string) AssetInterface
	MustAssetC(ctx context.Context, path string) AssetInterface
	AssetInfo(path string) (FileInfo, error)
	AssetInfoC(ctx context.Context, path string) (FileInfo, error)
	MustAssetInfo(path string) FileInfo
	MustAssetInfoC(ctx context.Context, path string) FileInfo
	AssetReader() AssetReaderFunc
	AssetReaderC() AssetReaderFuncC
	Provider(providers ...Interface)
	Providers() []Interface
}

type AssetInterface

type AssetInterface interface {
	Name() string
	Path() string
	Reader() (io.ReadCloser, error)
}

type AssetReaderFunc

type AssetReaderFunc = func(name string) (data []byte, err error)

type AssetReaderFuncC

type AssetReaderFuncC = func(ctx context.Context, name string) (data []byte, err error)

type BasicFileInfo

type BasicFileInfo interface {
	os.FileInfo
	Path() string
}

func NewBasicFileInfo

func NewBasicFileInfo(pth string, size int64, mode os.FileMode, modTime, changeTime time.Time) BasicFileInfo

func NewCleanedBasicFileInfo

func NewCleanedBasicFileInfo(pth string, name ...string) BasicFileInfo

func OsFileInfoToBasic

func OsFileInfoToBasic(pth string, info os.FileInfo) BasicFileInfo

func SetBasicFileInfoPath

func SetBasicFileInfoPath(b BasicFileInfo, path string) BasicFileInfo

type BasicFileInfoWithChangedTime

type BasicFileInfoWithChangedTime interface {
	BasicFileInfo
	ChangeTime() time.Time
}

type CbWalkFunc

type CbWalkFunc = func(name string, isDir bool) error

type CbWalkInfoFunc

type CbWalkInfoFunc = func(info FileInfo) error

type Compresseder

type Compresseder interface {
	Compressed() bool
}

type DirFileInfo

type DirFileInfo interface {
	FileInfo
	ReadDir(func(child FileInfo) error) error
}

type FileInfo

type FileInfo interface {
	RFileInfo
	Type() FileType
	GetFileInfo() os.FileInfo
	Reader() (io.ReadCloser, error)
}

type FileType

type FileType int
const (
	FileTypeNameSpace FileType = 1 << iota
	FileTypeNormal
	FileTypeDir
	FileTypeReal
	FileTypeBindata
)

func (FileType) IsBindata

func (f FileType) IsBindata() bool

func (FileType) IsDir

func (f FileType) IsDir() bool

func (FileType) IsNameSpace

func (f FileType) IsNameSpace() bool

func (FileType) IsNormal

func (f FileType) IsNormal() bool

func (FileType) IsReal

func (f FileType) IsReal() bool

type GetAssetInfoFunc

type GetAssetInfoFunc = func(name string) (info FileInfo, err error)

type GetAssetInfoFuncC

type GetAssetInfoFuncC = func(ctx context.Context, name string) (info FileInfo, err error)

type Glob

type Glob interface {
	GetPattern() GlobPattern
	SetPattern(pattern GlobPattern)
	FS() Interface
	Name(cb func(pth string, isDir bool) error) error
	NameOrPanic(cb func(pth string, isDir bool) error)
	Names() ([]string, error)
	SortedNames() ([]string, error)
	NamesOrPanic() []string
	Info(cb func(info FileInfo) error) error
	Infos() ([]FileInfo, error)
	SortedInfos() (items []FileInfo, err error)
	InfoOrPanic(cb func(info FileInfo) error)
	InfosOrPanic() []FileInfo
}

type GlobError

type GlobError struct {
	Err error
}

func (GlobError) Error

func (ge GlobError) Error() string

type GlobFunc

type GlobFunc = func(pattern GlobPattern, cb func(pth string, isDir bool) error) error

type GlobInfoFunc

type GlobInfoFunc = func(pattern GlobPattern, cb func(info FileInfo) error) error

type GlobPattern

type GlobPattern interface {
	Dir() string
	Pattern() string
	IsRecursive() bool
	AllowDirs() bool
	AllowFiles() bool
	Recursive() GlobPattern
	Match(value string) bool
	Wrap(dir ...string) GlobPattern
	GetPathFormatter() PathFormatterFunc
	PathFormatter(formatter PathFormatterFunc) GlobPattern
}

type HttpFileSystem

type HttpFileSystem struct {
	FS       Interface
	DirIndex bool
}

func NewHttpFileSystem

func NewHttpFileSystem(fs Interface) *HttpFileSystem

func (*HttpFileSystem) Open

func (fs *HttpFileSystem) Open(name string) (f http.File, err error)

type Interface

type Interface interface {
	AssetGetterInterface
	AssetCompilerInterface
	TraversableInterface
	LocalSourcesAttribute
	http.Handler
	GetNameSpace(nameSpace string) (NameSpacedInterface, error)
	NameSpaces() []NameSpacedInterface
	NameSpace(nameSpace string) NameSpacedInterface
	GetPath() string
	GetParent() Interface
	RegisterPlugin(plugins ...Plugin)
	DumpFiles(cb func(info FileInfo) error) error
	Dump(cb func(info FileInfo) error, ignore ...func(pth string) bool) error
}

type LocalSource

type LocalSource interface {
	Dir() string
	Get(name string) (info LocalSourceInfo, err error)
}

type LocalSourceInfo

type LocalSourceInfo interface {
	os.FileInfo
	Path() string
}

type LocalSourceRegister

type LocalSourceRegister interface {
	Register(name string, src LocalSource)
	Get(name string) (src LocalSource)
}

type LocalSourcesAttribute

type LocalSourcesAttribute interface {
	LocalSourcesGetter
	SetLocalSources(sources LocalSourceRegister)
}

type LocalSourcesGetter

type LocalSourcesGetter interface {
	LocalSources() LocalSourceRegister
}

type NameSpacedInterface

type NameSpacedInterface interface {
	Interface
	GetName() string
}

type PathFormatterFunc

type PathFormatterFunc = func(pth *string)

type PathRegisterCallback

type PathRegisterCallback = func(fs Interface)

type PathRegistrator

type PathRegistrator interface {
	Interface
	OnPathRegister(cb ...PathRegisterCallback)
	PrependPath(path string, ignoreExists ...bool) error
	RegisterPath(path string, ignoreExists ...bool) error
}

type Plugin

type Plugin interface {
	Init(fs Interface)
	PathRegisterCallback(fs Interface)
}

type RFileInfo

type RFileInfo interface {
	BasicFileInfo
	RealPath() string
}

type RawReadGetter

type RawReadGetter interface {
	RawReader() io.ReadCloser
}

type TraversableInterface

type TraversableInterface interface {
	Walk(dir string, cb CbWalkFunc, mode ...WalkMode) error
	WalkInfo(dir string, cb CbWalkInfoFunc, mode ...WalkMode) error
	ReadDir(dir string, cb CbWalkInfoFunc, skipDir bool) (err error)
	Glob(pattern GlobPattern, cb func(pth string, isDir bool) error) error
	GlobInfo(pattern GlobPattern, cb func(info FileInfo) error) error
	NewGlob(pattern GlobPattern) Glob
	NewGlobString(pattern string) Glob
}

type WalkFunc

type WalkFunc = func(pth string, cb CbWalkFunc, mode WalkMode) error

type WalkInfoFunc

type WalkInfoFunc = func(path string, cb CbWalkInfoFunc, mode WalkMode) error

type WalkMode

type WalkMode int
const (
	WalkDirs WalkMode = 1 << iota
	WalkFiles
	WalkNameSpaces
	WalkNameSpacesLookUp
	WalkParentLookUp
	WalkReverse

	WalkAll = WalkFiles | WalkDirs | WalkNameSpaces | WalkNameSpacesLookUp | WalkParentLookUp
)

func (WalkMode) IsDirs

func (f WalkMode) IsDirs() bool

func (WalkMode) IsFiles

func (f WalkMode) IsFiles() bool

func (WalkMode) IsNameSpaces

func (f WalkMode) IsNameSpaces() bool

func (WalkMode) IsNameSpacesLookUp

func (f WalkMode) IsNameSpacesLookUp() bool

func (WalkMode) IsParentLookUp

func (f WalkMode) IsParentLookUp() bool

func (WalkMode) IsReverse

func (f WalkMode) IsReverse() bool

Jump to

Keyboard shortcuts

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