forked from gobuffalo/packr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fn.go
44 lines (36 loc) · 962 Bytes
/
fn.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package store
import (
"errors"
"github.com/gobuffalo/packr/v2/jam/parser"
)
var _ Store = &FnStore{}
type FnStore struct {
FileNamesFn func(*parser.Box) ([]string, error)
FilesFn func(*parser.Box) ([]*parser.File, error)
PackFn func(*parser.Box) error
CleanFn func(*parser.Box) error
}
func (f *FnStore) FileNames(box *parser.Box) ([]string, error) {
if f.FileNamesFn == nil {
return []string{}, errors.New("FileNames not implemented")
}
return f.FileNames(box)
}
func (f *FnStore) Files(box *parser.Box) ([]*parser.File, error) {
if f.FilesFn == nil {
return []*parser.File{}, errors.New("Files not implemented")
}
return f.FilesFn(box)
}
func (f *FnStore) Pack(box *parser.Box) error {
if f.PackFn == nil {
return errors.New("Pack not implemented")
}
return f.PackFn(box)
}
func (f *FnStore) Clean(box *parser.Box) error {
if f.CleanFn == nil {
return errors.New("Clean not implemented")
}
return f.Clean(box)
}