store/file: add WithDir option (#2038)

This commit is contained in:
ben-toogood
2020-10-07 12:37:28 +01:00
committed by GitHub
parent 27aa1ff2ab
commit c701f96a09
3 changed files with 60 additions and 10 deletions

16
store/file/options.go Normal file
View File

@@ -0,0 +1,16 @@
package file
import (
"context"
"github.com/micro/go-micro/v3/store"
)
type dirKey struct{}
// WithDir sets the directory to store the files in
func WithDir(dir string) store.Option {
return func(o *store.Options) {
o.Context = context.WithValue(o.Context, dirKey{}, dir)
}
}