apiversion

package
v2.15.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: AGPL-3.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(version string) (major int, minor int, err error)

Parse parses a valid major.minor version string into (major, minor). Both major and minor must be valid integers separated by a period '.'.

Types

type APIVersion

type APIVersion struct {
	// contains filtered or unexported fields
}

func New

func New(maj, min int) *APIVersion

New returns an *APIVersion with the given major.minor and additional supported major versions.

func (*APIVersion) String

func (v *APIVersion) String() string

func (*APIVersion) Validate

func (v *APIVersion) Validate(version string) error

Validate validates the given version against the given constraints: A given major.minor version is valid iff:

  1. The requested major version is contained within v.supportedMajors
  2. If the requested major version is the 'current major', then the requested minor version must be less than or equal to the supported minor version.

For example, given majors {1, 2} and minor 2, then: - 0.x is not supported, - 1.x is supported, - 2.0, 2.1, and 2.2 are supported, - 2.3+ is not supported.

func (*APIVersion) WithBackwardCompat

func (v *APIVersion) WithBackwardCompat(majs ...int) *APIVersion

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL