bufparse

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullNameEqual

func FullNameEqual(one FullName, two FullName) bool

FullNameEqual returns true if the FullNames are equal.

func FullNameStringToUniqueValue

func FullNameStringToUniqueValue[T HasFullName, S ~[]T](values S) (map[string]T, error)

FullNameStringToValue maps the values that implement HasFullName to a map from FullName string to the unique value that has this FullName.

If any value has a nil FullName, this value is not added to the map. Therefore, for types that potentially have a nil FullName, you cannot reply on this function returning a map of the same length as the input values.

Returns error if there are values with duplicate FullNames.

Types

type FullName

type FullName interface {
	// String returns "registry/owner/name".
	fmt.Stringer

	// Registry returns the hostname of the BSR instance that this  is contained within.
	Registry() string
	// Owner returns the name of the user or organization that owns this .
	Owner() string
	// Name returns the name of the .
	Name() string
	// contains filtered or unexported methods
}

FullName represents the full name of the entity, including its registry, owner, and name.

func NewFullName

func NewFullName(
	registry string,
	owner string,
	name string,
) (FullName, error)

NewFullName returns a new FullName for the given components.

func ParseFullName

func ParseFullName(fullNameString string) (FullName, error)

ParseFullName parses a FullName from a string in the form "registry/owner/name".

Returns an error of type *ParseError if the string could not be parsed.

type HasFullName

type HasFullName interface {
	// FullName returns the ullName.
	//
	// May be empty.
	FullName() FullName
}

HasFullName is any type that has a FullName() function.

type ParseError

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

ParseError is an error that occurred during parsing.

This is returned by all Parse.* functions in this package.

func NewParseError

func NewParseError(typeString string, input string, err error) *ParseError

NewParseError returns a new ParseError.

typeString is the user-consumable string representing of the type that was attempted to be parsed. input is the input string that was attempted to be parsed. err is the underlying error.

func (*ParseError) Error

func (p *ParseError) Error() string

Error implements the error interface.

func (*ParseError) Input

func (p *ParseError) Input() string

Input returns the input string that was attempted to be parsed.

func (*ParseError) Unwrap

func (p *ParseError) Unwrap() error

Unwrap returns the underlying error.

type Ref

type Ref interface {
	// String returns "registry/owner/name[:ref]".
	fmt.Stringer

	// FullName returns the full name of the .
	//
	// Always present.
	FullName() FullName
	// Ref returns the reference within the .
	//
	// May be a label or dashless commitID.
	//
	// May be empty, in which case this references the commit of the default label of the .
	Ref() string
	// contains filtered or unexported methods
}

Ref is an unresolved reference to an entity.

func NewRef

func NewRef(
	registry string,
	owner string,
	name string,
	ref string,
) (Ref, error)

NewRef returns a new Ref for the given compoonents.

func ParseRef

func ParseRef(refString string) (Ref, error)

ParseRef parses a Ref from a string in the form "registry/owner/name[:ref]".

Returns an error of type *ParseError if the string could not be parsed.

Jump to

Keyboard shortcuts

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