Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageVersion ¶
type PackageVersion interface { fmt.Stringer // Required. // Will always be >=0. Major() int // Required. StabilityLevel() StabilityLevel // Optional. // Only potentially set if the stability level is alpha or beta. // Will always be >=1. Minor() int // Optional. // Only potentially set if the stability level is alpha or beta. // Will always be >=1. Patch() int // Optional. // Only potentially set if the stability level is test. Suffix() string // contains filtered or unexported methods }
PackageVersion is a package version.
A package has a version if the last component is a version of the form v\d+, v\d+test.*, v\d+(alpha|beta)\d*, or v\d+p\d+(alpha|beta)\d* where numbers are >=1.
Packages must have at least two components, that is "package v1beta1" does not have a package version, but "package foo.v1beta1" does.
See https://cloud.google.com/apis/design/versioning#channel-based_versioning See https://cloud.google.com/apis/design/versioning#release-based_versioning
func NewPackageVersionForComponent ¶ added in v1.27.0
func NewPackageVersionForComponent(component string, options ...PackageVersionOption) (PackageVersion, bool)
NewPackageVersionForCompoonent returns the PackageVersion for the package component.
Returns false if the component is not a package version per the specifications. That is, the component "v1beta1" will return true, while the component "foo" will return false.
Also returns false if the input is not a component. That is, the input "foo.bar" is not a component, this is a package.
func NewPackageVersionForPackage ¶
func NewPackageVersionForPackage(pkg string, options ...PackageVersionOption) (PackageVersion, bool)
NewPackageVersionForPackage returns the PackageVersion for the package.
Returns false if the package has no package version per the specifications.
type PackageVersionOption ¶ added in v1.27.0
type PackageVersionOption func(*packageVersionOptions)
PackageVersionOption is an option when constructing a new PackageVersion.
func WithAllowV0 ¶ added in v1.27.0
func WithAllowV0() PackageVersionOption
WithAllowV0 returns a new PackageVersionOption that allows major version numbers to be 0.
The default is to only allow 1+ major version numbers.
type StabilityLevel ¶
type StabilityLevel int
StabilityLevel is the stability level.
const ( // StabilityLevelStable is stable. StabilityLevelStable StabilityLevel = iota + 1 // StabilityLevelAlpha is alpha stability. StabilityLevelAlpha // StabilityLevelBeta is beta stability. StabilityLevelBeta // StabilityLevelTest is test stability. StabilityLevelTest )
func (StabilityLevel) String ¶
func (s StabilityLevel) String() string
String implements fmt.Stringer.