fakefs

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultFS

type DefaultFS struct{}

DefaultFS implements FileSystem using the local disk

func (DefaultFS) ReadDir

func (DefaultFS) ReadDir(name string) ([]os.DirEntry, error)

func (DefaultFS) ReadFile

func (DefaultFS) ReadFile(name string) ([]byte, error)

func (DefaultFS) Stat

func (DefaultFS) Stat(name string) (os.FileInfo, error)

type File

type File struct {
	Name    string
	Path    string
	Content string
}

type FileInfo

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

FileInfo implements the os.FileInfo and os.DirEntry interface

func NewFileInfo

func NewFileInfo() *FileInfo

func (*FileInfo) Info

func (f *FileInfo) Info() (os.FileInfo, error)

func (*FileInfo) IsDir

func (f *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (f *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (f *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (f *FileInfo) Name() string

func (*FileInfo) Size

func (f *FileInfo) Size() int64

func (*FileInfo) Sys

func (f *FileInfo) Sys() interface{}

func (*FileInfo) Type

func (f *FileInfo) Type() os.FileMode

type FileSystem

type FileSystem interface {
	Stat(name string) (os.FileInfo, error)
	ReadFile(name string) ([]byte, error)
	ReadDir(name string) ([]os.DirEntry, error)
}

type NotExistFS

type NotExistFS struct{}

NotExistFS will always return os.ErrNotExist type errors from calls to Stat

func (NotExistFS) ReadDir

func (NotExistFS) ReadDir(name string) ([]os.DirEntry, error)

func (NotExistFS) ReadFile

func (NotExistFS) ReadFile(name string) ([]byte, error)

func (NotExistFS) Stat

func (NotExistFS) Stat(name string) (os.FileInfo, error)

type StringFS

type StringFS struct {
	Files []File
}

StringFS holds a slice of files

func (StringFS) ReadDir

func (fs StringFS) ReadDir(name string) ([]os.DirEntry, error)

func (StringFS) ReadFile

func (fs StringFS) ReadFile(name string) ([]byte, error)

func (StringFS) Stat

func (fs StringFS) Stat(name string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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