mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 11:04:25 +00:00
19 lines
357 B
Go
19 lines
357 B
Go
|
package eventstore
|
||
|
|
||
|
import (
|
||
|
"regexp"
|
||
|
|
||
|
"github.com/caos/zitadel/internal/errors"
|
||
|
)
|
||
|
|
||
|
var versionRegexp = regexp.MustCompile(`^v[0-9]+(\.[0-9]+){0,2}$`)
|
||
|
|
||
|
type Version string
|
||
|
|
||
|
func (v Version) Validate() error {
|
||
|
if !versionRegexp.MatchString(string(v)) {
|
||
|
return errors.ThrowPreconditionFailed(nil, "MODEL-luDuS", "version is not semver")
|
||
|
}
|
||
|
return nil
|
||
|
}
|