version

package
v0.0.0-...-6d13978 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Latest = Ref("latest")
View Source
const Public = Ref("public")

Variables

View Source
var ErrArchived = rerror.NewE(i18n.T("archived"))

Functions

func MatchVersionOrRef

func MatchVersionOrRef[T any](vr VersionOrRef, v func(v Version) T, r func(r Ref) T) (_ T)

func UnwrapValues

func UnwrapValues[T any](l []*Value[T]) []T

Types

type Query

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

func All

func All() Query

func Eq

func Eq(vr VersionOrRef) Query

func (Query) Match

func (q Query) Match(m QueryMatch)

type QueryMatch

type QueryMatch struct {
	All func()
	Eq  func(VersionOrRef)
}

type Ref

type Ref string

func (Ref) IsSpecial

func (r Ref) IsSpecial() bool

func (*Ref) OrLatest

func (r *Ref) OrLatest() *Ref

func (Ref) OrVersion

func (r Ref) OrVersion() VersionOrRef

func (Ref) Ref

func (r Ref) Ref() *Ref

func (Ref) String

func (r Ref) String() string

type Refs

type Refs = set.Set[Ref]

func NewRefs

func NewRefs(refs ...Ref) Refs

type Value

type Value[T any] struct {
	// contains filtered or unexported fields
}

func MustBeValue

func MustBeValue[T any](version Version, parents Versions, refs Refs, t time.Time, value T) *Value[T]

func NewValue

func NewValue[T any](version Version, parents Versions, refs Refs, t time.Time, value T) *Value[T]

func ValueFrom

func ValueFrom[T, K any](v *Value[T], vv K) *Value[K]

func (*Value[T]) AddRefs

func (v *Value[T]) AddRefs(refs ...Ref)

func (*Value[T]) Clone

func (v *Value[T]) Clone() *Value[T]

func (*Value[T]) DeleteRefs

func (v *Value[T]) DeleteRefs(refs ...Ref)

func (Value[T]) Parents

func (v Value[T]) Parents() Versions

func (Value[T]) Ref

func (v Value[T]) Ref() *Value[T]

func (Value[T]) Refs

func (v Value[T]) Refs() Refs

func (Value[T]) Time

func (v Value[T]) Time() time.Time

func (Value[T]) Value

func (v Value[T]) Value() T

func (Value[T]) Version

func (v Value[T]) Version() Version

type Values

type Values[T any] struct {
	// contains filtered or unexported fields
}

func MustBeValues

func MustBeValues[V any](values ...*Value[V]) *Values[V]

func NewValues

func NewValues[V any](values ...*Value[V]) *Values[V]

func (*Values[V]) Add

func (v *Values[V]) Add(value V, parent *VersionOrRef)

func (*Values[V]) All

func (v *Values[V]) All() []*Value[V]

func (*Values[V]) Clone

func (v *Values[V]) Clone() *Values[V]

func (*Values[V]) Get

func (v *Values[V]) Get(vr VersionOrRef) *Value[V]

func (*Values[V]) IsArchived

func (v *Values[V]) IsArchived() bool

func (*Values[V]) IsEmpty

func (v *Values[V]) IsEmpty() bool

func (*Values[V]) Latest

func (v *Values[V]) Latest() *Value[V]

func (*Values[V]) LatestVersion

func (v *Values[V]) LatestVersion() *Version

func (*Values[V]) SetArchived

func (v *Values[V]) SetArchived(archived bool) *Values[V]

func (*Values[V]) UpdateRef

func (v *Values[V]) UpdateRef(r Ref, vr *VersionOrRef)

type Version

type Version uuid.UUID
var Zero Version = Version(uuid.UUID{})

func New

func New() Version

func ParseVersion

func ParseVersion(ver *string) *Version

func (Version) IsZero

func (v Version) IsZero() bool

func (Version) OrRef

func (v Version) OrRef() VersionOrRef

func (Version) Ref

func (v Version) Ref() *Version

func (Version) String

func (v Version) String() string

type VersionOrRef

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

func ToVersionOrLatestRef

func ToVersionOrLatestRef(ver *string) VersionOrRef

func (VersionOrRef) IsRef

func (vr VersionOrRef) IsRef(ref Ref) bool

func (VersionOrRef) IsSpecialRef

func (vr VersionOrRef) IsSpecialRef() bool

func (VersionOrRef) IsZero

func (vr VersionOrRef) IsZero() bool

func (VersionOrRef) Match

func (vr VersionOrRef) Match(v func(v Version), r func(r Ref))

func (VersionOrRef) Ref

func (vr VersionOrRef) Ref() *VersionOrRef

type Versions

type Versions = set.Set[Version]

func NewVersions

func NewVersions(v ...Version) Versions

Jump to

Keyboard shortcuts

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