result

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AttestationReasonKey     = "reason"
	AttestationSBOMCore      = "sbom-core"
	AttestationInlineOnlyKey = "inline-only"
)
View Source
const (
	AttestationReasonSBOM       = "sbom"
	AttestationReasonProvenance = "provenance"
)

Variables

This section is empty.

Functions

func EachRef

func EachRef[U comparable, V comparable](a *Result[U], b *Result[V], fn func(U, V) error) (err error)

EachRef iterates over references in both a and b. a and b are assumed to be of the same size and map their references to the same set of keys

func FromDigestMap

func FromDigestMap(m map[string]string) []digest.Digest

func ToDigestMap

func ToDigestMap(ds ...digest.Digest) map[string]string

Types

type Attestation

type Attestation[T any] struct {
	Kind pb.AttestationKind

	Metadata map[string][]byte

	Ref         T
	Path        string
	ContentFunc func() ([]byte, error)

	InToto InTotoAttestation
}

func ConvertAttestation

func ConvertAttestation[U comparable, V comparable](a *Attestation[U], fn func(U) (V, error)) (*Attestation[V], error)

type InTotoAttestation

type InTotoAttestation struct {
	PredicateType string
	Subjects      []InTotoSubject
}

type InTotoSubject

type InTotoSubject struct {
	Kind pb.InTotoSubjectKind

	Name   string
	Digest []digest.Digest
}

type Result

type Result[T comparable] struct {
	Ref          T
	Refs         map[string]T
	Metadata     map[string][]byte
	Attestations map[string][]Attestation[T]
	// contains filtered or unexported fields
}

func ConvertResult

func ConvertResult[U comparable, V comparable](r *Result[U], fn func(U) (V, error)) (*Result[V], error)

func (*Result[T]) AddAttestation

func (r *Result[T]) AddAttestation(k string, v Attestation[T])

func (*Result[T]) AddMeta

func (r *Result[T]) AddMeta(k string, v []byte)

func (*Result[T]) AddRef

func (r *Result[T]) AddRef(k string, ref T)

func (*Result[T]) EachRef

func (r *Result[T]) EachRef(fn func(T) error) (err error)

func (*Result[T]) FindRef

func (r *Result[T]) FindRef(key string) (T, bool)

func (*Result[T]) SetRef

func (r *Result[T]) SetRef(ref T)

func (*Result[T]) SingleRef

func (r *Result[T]) SingleRef() (T, error)

Jump to

Keyboard shortcuts

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