goblet: github.com/deadcheat/goblet Index | Files | Directories

package goblet

import "github.com/deadcheat/goblet"


Package Files

errors.go file.go filesystem.go


var (
    // ErrFileNotFound error when file is not found
    ErrFileNotFound = errors.New("specified file is not found")

type File Uses

type File struct {
    Path       string
    Data       []byte
    FileMode   os.FileMode
    ModifiedAt time.Time
    // contains filtered or unexported fields

File file system model for each files

func NewFile Uses

func NewFile(p string, d []byte, m os.FileMode, mat time.Time) *File

NewFile return new file

func NewFromFileInfo Uses

func NewFromFileInfo(fi os.FileInfo, p string, d []byte) *File

NewFromFileInfo return new file

func (*File) Close Uses

func (f *File) Close() error

Close implement for io.Closer

func (*File) IsDir Uses

func (f *File) IsDir() bool

IsDir implement for os.FileInfo

func (*File) ModTime Uses

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

ModTime implement for os.FileInfo

func (*File) Mode Uses

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

Mode implement for os.FileInfo

func (*File) Name Uses

func (f *File) Name() string

Name implement for os.FileInfo

func (*File) Read Uses

func (f *File) Read(data []byte) (int, error)

Read for io.Reader

func (*File) Readdir Uses

func (f *File) Readdir(count int) ([]os.FileInfo, error)

Readdir implement for http.File

func (*File) Seek Uses

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek for io.Seeker

func (*File) Size Uses

func (f *File) Size() int64

Size implement for os.FileInfo

func (*File) Stat Uses

func (f *File) Stat() (os.FileInfo, error)

Stat implement for http.File

func (*File) Sys Uses

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

Sys implement for os.FileInfo

type FileSystem Uses

type FileSystem struct {
    Dirs  map[string][]string
    Files map[string]*File
    // contains filtered or unexported fields

FileSystem exported to a generated asset file

func NewFS Uses

func NewFS(dirs map[string][]string, files map[string]*File) *FileSystem

NewFS return newFS FileSystem pointer

func (*FileSystem) Exists Uses

func (fs *FileSystem) Exists(name string) bool

Exists check whether file exists

func (*FileSystem) File Uses

func (fs *FileSystem) File(filename string) (*File, error)

File returns file struct

func (*FileSystem) Open Uses

func (fs *FileSystem) Open(name string) (http.File, error)

Open file from name

func (*FileSystem) ReadDir Uses

func (fs *FileSystem) ReadDir(dirname string) ([]os.FileInfo, error)

ReadDir return all files in specified directory

func (*FileSystem) ReadFile Uses

func (fs *FileSystem) ReadFile(filename string) ([]byte, error)

ReadFile read file and return []byte like as ioutil.ReadFile

func (*FileSystem) WithIgnoredPrefix Uses

func (fs *FileSystem) WithIgnoredPrefix(prefix string) (newFs *FileSystem)

IgnoredPrefix set FileSystem.pathPrefix and return FileSystem itself

func (*FileSystem) WithPrefix Uses

func (fs *FileSystem) WithPrefix(prefix string) (newFs *FileSystem)

WithPrefix set FileSystem.pathPrefix and return FileSystem itself


generator/mockPackage mock is a generated GoMock package.

Package goblet imports 8 packages (graph) and is imported by 2 packages. Updated 2019-03-01. Refresh now. Tools for package owners.