helper

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(arr []string, target string) bool

func ExtractRepoNameFromRepoURL

func ExtractRepoNameFromRepoURL(repoURL string) (string, error)

func ExtractVersionFromTag

func ExtractVersionFromTag(tag string) (float64, error)

ExtractVersionFromTag parses a semantic versioning tag string and converts it to a float64 value for comparison purposes. The tag is expected to follow the format 'v<major>.<minor>.<patch>' (e.g., 'v1.2.3'). It returns an error for invalid formats or parsing issues.

func IsAnyNumber

func IsAnyNumber(value interface{}) (float64, bool)

IsAnyNumber checks if the interface{} is any numeric type. Returns the numeric value as float64 (if it is a number) and a bool indicating whether it is a number.

Types

type ConcurrentMap

type ConcurrentMap[T interface{}] struct {
	// contains filtered or unexported fields
}

ConcurrentMap is a struct that allows adding keys to a map from multiple goroutines executed in parallel.

func NewConcurrentMap

func NewConcurrentMap[T any]() *ConcurrentMap[T]

NewConcurrentMap initializes a new ConcurrentMap.

func (*ConcurrentMap[T]) Get

func (cm *ConcurrentMap[T]) Get(key string) (T, bool)

Get retrieves a value for a given key from the map.

func (*ConcurrentMap[T]) GetMap

func (cm *ConcurrentMap[T]) GetMap() map[string]T

Get full map.

func (*ConcurrentMap[T]) Set

func (cm *ConcurrentMap[T]) Set(key string, value T)

Set sets a key-value pair in the map.

type SemanticVersion

type SemanticVersion struct {
	Major int64
	Minor int64
	Patch int64
}

func ExtractSemanticVersionFromTag

func ExtractSemanticVersionFromTag(tag string) (SemanticVersion, error)

func (SemanticVersion) IsGreaterThan

func (sm SemanticVersion) IsGreaterThan(other SemanticVersion) bool

Jump to

Keyboard shortcuts

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