mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
d8e42744b4
* fix: move eventstore pkgs * fix: move eventstore pkgs * fix: remove v2 view * fix: remove v2 view
23 lines
409 B
Go
23 lines
409 B
Go
package models
|
|
|
|
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
|
|
}
|
|
|
|
func (v Version) String() string {
|
|
return string(v)
|
|
}
|