Documentation ¶
Index ¶
- func Content(data string) io.WriterTo
- func ContentByte(data []byte) io.WriterTo
- func ContentFrom(r io.Reader) io.WriterTo
- type DirWriter
- func (dirs DirWriter) Dirs(rootDir string, cb func(hostDirPath string, hostDir DirWriter) error) error
- func (dirs DirWriter) Files(rootDir string, cb func(hostFilePath string, hostFile FileWriter) error) error
- func (dirs DirWriter) GetDir(dirPath string) (DirWriter, error)
- func (dirs DirWriter) GetFile(filePath string) (FileWriter, error)
- type FileWriter
- type Filesystem
- type GzipTarFileSystem
- type JSONFileSystem
- type MemoryFileSystem
- func (mfs MemoryFileSystem) Dirs(cb func(hostFilePath string, hostFile DirWriter) error) error
- func (mfs MemoryFileSystem) Files(cb func(hostFilePath string, hostFile FileWriter) error) error
- func (mfs MemoryFileSystem) GetDir(dirPath string) (DirWriter, error)
- func (mfs MemoryFileSystem) GetFile(filePath string) (FileWriter, error)
- type MetaOption
- type TarFileSystem
- type ZipFileSystem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContentByte ¶
ContentByte returns a io.WriterTo containing the provided data bytes.
Types ¶
type DirWriter ¶
type DirWriter struct { Name string ChildFiles []FileWriter ChildDirs []DirWriter }
DirWriter implements a structure that represents a file system directory with associated files and name.
func Dir ¶
Dir returns a instance of a DirWriter with associated name. The files are scanned and are appropriately allocated if they are FileWriter or DirWriter.
func (DirWriter) Dirs ¶
func (dirs DirWriter) Dirs(rootDir string, cb func(hostDirPath string, hostDir DirWriter) error) error
Dirs runs through all child directory returning appropriate path and current item associated for that DirWriter.
func (DirWriter) Files ¶
func (dirs DirWriter) Files(rootDir string, cb func(hostFilePath string, hostFile FileWriter) error) error
Files runs through all child directory returning appropriate path and current item associated for that DirWriter.
type FileWriter ¶
FileWriter defines a structure that represent a file system file item with associated content.
type Filesystem ¶
Filesystem defines a interface which expose a an underline compressed/uncompressed filesystem which can be written out into a writer or produce a reader for reading has a single binary stream of bytes.
type GzipTarFileSystem ¶
type GzipTarFileSystem struct {
FS MemoryFileSystem
}
GzipTarFileSystem implements io.WriteTo and transforms the MemoryFileSystem into a tar archive using the archive/tar writer to wrap a compress/gzip writer.
func GzipTarFS ¶
func GzipTarFS(fs MemoryFileSystem) GzipTarFileSystem
GzipTarFS returns a new instance of the GzipTarFileSystem.
type JSONFileSystem ¶
type JSONFileSystem struct { FS MemoryFileSystem // contains filtered or unexported fields }
JSONFileSystem implements io.WriteTo and transforms the MemoryFileSystem into a json hashmap using the encoding/json encoders.
func JSONFS ¶
func JSONFS(fs MemoryFileSystem, indent bool) JSONFileSystem
JSONFS returns a new instance of the JSONFileSystem.
type MemoryFileSystem ¶
MemoryFileSystem defines a file system with associated files and directories which are to be converted into appropriate data stream by a consumer.
func FileSystem ¶
func FileSystem(content ...interface{}) MemoryFileSystem
FileSystem returns a instance of a FSWriter.
func (MemoryFileSystem) Dirs ¶
func (mfs MemoryFileSystem) Dirs(cb func(hostFilePath string, hostFile DirWriter) error) error
Dirs runs through all filesystem child directories returning appropriate path and file to the provided callback.
func (MemoryFileSystem) Files ¶
func (mfs MemoryFileSystem) Files(cb func(hostFilePath string, hostFile FileWriter) error) error
Files runs through all filesystem files and child directory files returning appropriate path and file to the provided callback.
func (MemoryFileSystem) GetDir ¶
func (mfs MemoryFileSystem) GetDir(dirPath string) (DirWriter, error)
GetDir returns the associated FileWriter for the giving relative filepath. Absolute path will be rejected.
func (MemoryFileSystem) GetFile ¶
func (mfs MemoryFileSystem) GetFile(filePath string) (FileWriter, error)
GetFile returns the associated FileWriter for the giving relative filepath. Absolute path will be rejected.
type MetaOption ¶
type MetaOption func(map[string]interface{})
MetaOption defines a function which receives a map to set values as desired.
func Description ¶
func Description(desc string, items ...interface{}) MetaOption
Description sets the "description" key to the provided string in a map.
func Meta ¶
func Meta(name string, val interface{}) MetaOption
Meta sets the key(name) to the val in a map.
func MetaApply ¶
func MetaApply(ops ...MetaOption) MetaOption
MetaApply returns a MetaOption that applies a series of provided options to a map.
func MetaText ¶
func MetaText(name string, message string, vals ...interface{}) MetaOption
MetaText sets the key(name) to the val in a map.
func Version ¶
func Version(ver string) MetaOption
Version sets the "version" key to the provided string in a map.
type TarFileSystem ¶
type TarFileSystem struct {
FS MemoryFileSystem
}
TarFileSystem implements io.WriteTo and transforms the MemoryFileSystem into a tar archive using the archive/tar writers.
func TarFS ¶
func TarFS(fs MemoryFileSystem) TarFileSystem
TarFS returns a new instance of the TarFileSystem.
type ZipFileSystem ¶
type ZipFileSystem struct {
FS MemoryFileSystem
}
ZipFileSystem implements io.WriteTo and transforms the MemoryFileSystem into a tar archive using the archive/zip writers.
func ZipFS ¶
func ZipFS(fs MemoryFileSystem) ZipFileSystem
ZipFS returns a new instance of the ZipFileSystem.