luci: Index | Files

package pbutil

import ""

Package pbutil implements utility functions for ResultDB protobuf messages.


Package Files

common.go doc.go invocation.go strpair.go testresult.go variantdef.go

func InvocationName Uses

func InvocationName(id string) string

InvocationName produces an invocation name from an id. Does not validate id, use ValidateInvocationID.

func IsFinalized Uses

func IsFinalized(state pb.Invocation_State) bool

IsFinalized returns whether the given invocation state is final, indicating immutability.

func MustParseInvocationName Uses

func MustParseInvocationName(name string) (id string)

MustParseInvocationName retrieves the invocation id. Panics if the name is invalid. Useful for situations when name was already validated.

func NormalizeInvocation Uses

func NormalizeInvocation(inv *pb.Invocation)

NormalizeInvocation converts inv to the canonical form.

func NormalizeTestResult Uses

func NormalizeTestResult(tr *pb.TestResult)

NormalizeTestResult converts inv to the canonical form.

func NormalizeTestResultSlice Uses

func NormalizeTestResultSlice(trs []*pb.TestResult)

NormalizeTestResultSlice converts trs to the canonical form.

func ParseInvocationName Uses

func ParseInvocationName(name string) (id string, err error)

ParseInvocationName retrieves the invocation id.

func SortedVariantDefKeys Uses

func SortedVariantDefKeys(d *pb.VariantDef) []string

SortedVariantDefKeys returns the keys in the variant def as a sorted slice.

func StringPair Uses

func StringPair(k, v string) *pb.StringPair

StringPair creates a pb.StringPair with the given strings as key/value field values.

func StringPairFromString Uses

func StringPairFromString(s string) (*pb.StringPair, error)

StringPairFromString creates a pb.StringPair from the given key:val string.

func StringPairs Uses

func StringPairs(pairs ...string) []*pb.StringPair

StringPairs creates a slice of pb.StringPair from a list of strings alternating key/value.

Panics if an odd number of tokens is passed.

func StringPairsContain Uses

func StringPairsContain(pairs []*pb.StringPair, item *pb.StringPair) bool

StringPairsContain checks if item is present in pairs.

func StringPairsToStrings Uses

func StringPairsToStrings(pairs ...*pb.StringPair) []string

StringPairsToStrings converts pairs to a slice of "{key}:{value}" strings in the same order.

func ValidateInvocationID Uses

func ValidateInvocationID(id string) error

ValidateInvocationID returns a non-nil error if id is invalid.

func ValidateStringPair Uses

func ValidateStringPair(p *pb.StringPair) error

ValidateStringPair returns an error if p is invalid.

func ValidateStringPairs Uses

func ValidateStringPairs(pairs []*pb.StringPair) error

ValidateStringPairs returns an error if any of the pairs is invalid.

func ValidateVariantDef Uses

func ValidateVariantDef(d *pb.VariantDef) error

ValidateVariantDef returns an error if def is invalid.

func VariantDefFromStrings Uses

func VariantDefFromStrings(pairs []string) (*pb.VariantDef, error)

VariantDefFromStrings returns a VariantDef proto given the key:val string slice of its contents.

If a key appears multiple times, the last pair wins.

func VariantDefPairs Uses

func VariantDefPairs(d *pb.VariantDef) []string

VariantDefPairs returns a key:val string slice representation of the VariantDef.

Package pbutil imports 5 packages (graph) and is imported by 2 packages. Updated 2019-10-22. Refresh now. Tools for package owners.