result

package
v0.13.2 Latest Latest
Warning

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

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

Documentation

Overview

Package result provides utilities for manipulating and validating Results.

Index

Constants

This section is empty.

Variables

View Source
var (
	// NameRegex matches valid name specs for a Result.
	NameRegex = regexp.MustCompile("(^[a-z0-9_-]{1,63})/results/([a-z0-9_-]{1,63}$)")
)

Functions

func FormatName

func FormatName(parent, name string) string

FormatName takes in a parent ("a") and result name ("b") and returns the full resource name ("a/results/b").

func Match

func Match(r *pb.Result, prg cel.Program) (bool, error)

Match determines whether the given CEL filter matches the result.

func ParseName

func ParseName(raw string) (parent, name string, err error)

ParseName splits a full Result name into its individual (parent, name) components.

func ToAPI

func ToAPI(r *db.Result) *pb.Result

ToAPI converts a database storage Result into its corresponding API equivalent.

func ToStorage

func ToStorage(r *pb.Result) (*db.Result, error)

ToStorage converts an API Result into its corresponding database storage equivalent. parent,name should be the name parts (e.g. not containing "/results/").

func UpdateEtag

func UpdateEtag(r *db.Result) error

UpdateEtag updates the etag field of a result according to its content. The result should at least have its `Id` and `UpdatedTime` fields set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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