MCPcopy Create free account
hub / github.com/bytebase/bytebase / NewVersion

Function NewVersion

backend/store/model/version.go:14–28  ·  view source on GitHub ↗
(v string)

Source from the content-addressed store, hash-verified

12}
13
14func NewVersion(v string) (*Version, error) {
15 if v == "" {
16 return nil, errors.New("version cannot be empty")
17 }
18 parts := strings.Split(v, ".")
19 r := &Version{}
20 for _, p := range parts {
21 n, err := strconv.ParseUint(p, 10, 64)
22 if err != nil {
23 return nil, errors.Errorf("invalid version %q", v)
24 }
25 r.parts = append(r.parts, n)
26 }
27 return r, nil
28}
29
30func (v *Version) LessThan(other *Version) bool {
31 l := min(len(other.parts), len(v.parts))

Callers 5

createRevisionsMethod · 0.92
TestVersionLessThanFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by 1

TestVersionLessThanFunction · 0.68