API improvements
This commit is contained in:
parent
1029f23558
commit
7f3789a6d4
6
file.go
6
file.go
@ -107,6 +107,12 @@ func (f *file) Meta() map[string]interface{} {
|
||||
return f.meta
|
||||
}
|
||||
|
||||
func (f *file) Apply(m map[string]interface{}) {
|
||||
for key, value := range m {
|
||||
f.meta[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
func (f *file) Read(p []byte) (int, error) {
|
||||
if err := f.cache(); err != nil {
|
||||
return 0, err
|
||||
|
5
types.go
5
types.go
@ -46,13 +46,10 @@ func New(srcDir, dstDir string) Goldsmith {
|
||||
|
||||
type File interface {
|
||||
Path() string
|
||||
Rename(path string)
|
||||
|
||||
Meta() map[string]interface{}
|
||||
|
||||
Apply(m map[string]interface{})
|
||||
Read(p []byte) (int, error)
|
||||
WriteTo(w io.Writer) (int64, error)
|
||||
Rewrite(data []byte)
|
||||
}
|
||||
|
||||
func NewFileFromData(path string, data []byte) File {
|
||||
|
Loading…
Reference in New Issue
Block a user