lite/option.go
2025-09-07 01:29:18 -04:00

29 lines
407 B
Go

package lite
import (
"fmt"
)
var (
ErrBadFilename error = fmt.Errorf("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
}
}