lite/option.go
2025-09-08 17:04:22 -04:00

27 lines
405 B
Go

package lite
import "errors"
var (
ErrBadFilename error = errors.New("database filename cannot be empty")
)
type Option func(d *database) error
func WithFile(name string) Option {
return func(d *database) error {
if name == "" {
return ErrBadFilename
}
d.file = name
return nil
}
}
func WithPath(path string) Option {
return func(d *database) error {
d.path = path
return nil
}
}