Documentation ¶
Index ¶
- type SemverRegistry
- func (sr *SemverRegistry) LinkHandler(fh sprout.Handler) error
- func (br *SemverRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
- func (fh *SemverRegistry) Semver(version string) (*semver.Version, error)
- func (fh *SemverRegistry) SemverCompare(constraint, version string) (bool, error)
- func (sr *SemverRegistry) Uid() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SemverRegistry ¶
type SemverRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *SemverRegistry
NewRegistry creates a new instance of your registry with the embedded Handler.
func (*SemverRegistry) LinkHandler ¶
func (sr *SemverRegistry) LinkHandler(fh sprout.Handler) error
LinkHandler links the handler to the registry at runtime.
func (*SemverRegistry) RegisterFunctions ¶
func (br *SemverRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
RegisterFunctions registers all functions of the registry.
func (*SemverRegistry) Semver ¶
func (fh *SemverRegistry) Semver(version string) (*semver.Version, error)
Semver creates a new semantic version object from a given version string.
Parameters:
version string - the version string to parse into a semantic version object.
Returns:
*semver.Version - the parsed semantic version object. error - an error if the version string is invalid.
Example:
{{ semver "1.0.0" }} // Output: semver.Version object
func (*SemverRegistry) SemverCompare ¶
func (fh *SemverRegistry) SemverCompare(constraint, version string) (bool, error)
SemverCompare checks if a given version string satisfies a specified semantic version constraint.
Parameters:
constraint string - the version constraint to check against. version string - the version string to validate against the constraint.
Returns:
bool - true if the version satisfies the constraint, false otherwise. error - an error if either the constraint or version string is invalid.
Example:
{{ semverCompare ">=1.0.0" "1.0.0" }} // Output: true
func (*SemverRegistry) Uid ¶
func (sr *SemverRegistry) Uid() string
Uid returns the unique identifier of the registry.
Click to show internal directories.
Click to hide internal directories.