Documentation ¶
Overview ¶
Package record provides utilities for manipulating and validating Records.
Index ¶
- Variables
- func FormatName(parent, name string) string
- func Match(r *pb.Record, prg cel.Program) (bool, error)
- func ParseName(raw string) (parent, result, name string, err error)
- func ToAPI(r *db.Record) (*pb.Record, error)
- func ToStorage(parent, resultName, resultID, name string, r *pb.Record) (*db.Record, error)
- func UpdateEtag(r *db.Record) error
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})/records/([a-z0-9_-]{1,63}$)") )
Functions ¶
func FormatName ¶
FormatName takes in a parent ("a/results/b") and record name ("c") and returns the full resource name ("a/results/b/records/c").
func ParseName ¶
ParseName splits a full Result name into its individual (parent, result, name) components.
func ToStorage ¶
ToStorage converts an API Record into its corresponding database storage equivalent. parent,result,name should be the name parts (e.g. not containing "/results/" or "/records/").
func UpdateEtag ¶
UpdateEtag updates the etag field of a record according to its content. The record should at least have its `Id` and `UpdatedTime` fields set.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.