15 lines
257 B
Go
15 lines
257 B
Go
|
package store
|
||
|
|
||
|
import "github.com/pkg/errors"
|
||
|
|
||
|
type Name string
|
||
|
|
||
|
var ErrEmptyName = errors.New("name cannot be empty")
|
||
|
|
||
|
func ValidateName(name string) (Name, error) {
|
||
|
if name == "" {
|
||
|
return "", errors.WithStack(ErrEmptyName)
|
||
|
}
|
||
|
return Name(name), nil
|
||
|
}
|