This commit is contained in:
Alex Yatskov 2024-02-19 22:23:21 -08:00
parent c0c940156f
commit 771b40e82e
2 changed files with 36 additions and 35 deletions

View File

@ -1,10 +1,5 @@
package goldsmith package goldsmith
import (
"io"
"time"
)
// Plugin contains the minimum set of methods required on plugins. Plugins can // Plugin contains the minimum set of methods required on plugins. Plugins can
// also optionally implement Initializer, Processor, and Finalizer interfaces. // also optionally implement Initializer, Processor, and Finalizer interfaces.
type Plugin interface { type Plugin interface {
@ -33,33 +28,3 @@ type Filter interface {
Name() string Name() string
Accept(file File) bool Accept(file File) bool
} }
type (
FileProp any
FileProps map[string]FileProp
)
// File represents in-memory or on-disk files in a chain.
type File interface {
Path() string
Dir() string
Name() string
Ext() string
Rename(path string) error
Size() int64
ModTime() time.Time
Read(data []byte) (int, error)
WriteTo(writer io.Writer) (int64, error)
Seek(offset int64, whence int) (int64, error)
SetProp(name string, value FileProp)
Prop(name string) (FileProp, bool)
PropOrDef(name string, valueDef FileProp) FileProp
Props() FileProps
CopyProps(file File)
RemoveProp(name string)
GoString() string
}

36
file.go Normal file
View File

@ -0,0 +1,36 @@
package goldsmith
import (
"io"
"time"
)
type (
FileProp any
FileProps map[string]FileProp
)
// File represents in-memory or on-disk files in a chain.
type File interface {
Path() string
Dir() string
Name() string
Ext() string
Rename(path string) error
Size() int64
ModTime() time.Time
Read(data []byte) (int, error)
WriteTo(writer io.Writer) (int64, error)
Seek(offset int64, whence int) (int64, error)
SetProp(name string, value FileProp)
Prop(name string) (FileProp, bool)
PropOrDef(name string, valueDef FileProp) FileProp
Props() FileProps
CopyProps(file File)
RemoveProp(name string)
GoString() string
}