Minor API update

This commit is contained in:
Alex Yatskov 2015-12-30 11:06:29 +09:00
parent 23ba57e6a8
commit 04ab83ae22
2 changed files with 9 additions and 7 deletions

View File

@ -32,7 +32,7 @@ import (
type file struct { type file struct {
path string path string
Meta map[string]interface{} Meta map[string]Meta
reader *bytes.Reader reader *bytes.Reader
asset string asset string
@ -93,12 +93,12 @@ func (f *file) Path() string {
return f.path return f.path
} }
func (f *file) Value(key string) (interface{}, bool) { func (f *file) Value(key string) (Meta, bool) {
value, ok := f.Meta[key] value, ok := f.Meta[key]
return value, ok return value, ok
} }
func (f *file) SetValue(key string, value interface{}) { func (f *file) SetValue(key string, value Meta) {
f.Meta[key] = value f.Meta[key] = value
} }

View File

@ -46,8 +46,8 @@ func New(srcDir, dstDir string) Goldsmith {
type File interface { type File interface {
Path() string Path() string
Value(key string) (interface{}, bool) Value(key string) (Meta, bool)
SetValue(key string, value interface{}) SetValue(key string, value Meta)
CopyValues(src File) CopyValues(src File)
Read(p []byte) (int, error) Read(p []byte) (int, error)
@ -58,7 +58,7 @@ type File interface {
func NewFileFromData(path string, data []byte) File { func NewFileFromData(path string, data []byte) File {
return &file{ return &file{
path: path, path: path,
Meta: make(map[string]interface{}), Meta: make(map[string]Meta),
reader: bytes.NewReader(data), reader: bytes.NewReader(data),
} }
} }
@ -66,7 +66,7 @@ func NewFileFromData(path string, data []byte) File {
func NewFileFromAsset(path, asset string) File { func NewFileFromAsset(path, asset string) File {
return &file{ return &file{
path: path, path: path,
Meta: make(map[string]interface{}), Meta: make(map[string]Meta),
asset: asset, asset: asset,
} }
} }
@ -105,3 +105,5 @@ type Finalizer interface {
} }
type Plugin interface{} type Plugin interface{}
type Meta interface{}