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
- func ToStorage(parent, resultName, resultID, name string, r *pb.Record, config *config.Config) (*db.Record, error)
- func UpdateEtag(r *db.Record) error
- func ValidateType(t string) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
func ToStorage(parent, resultName, resultID, name string, r *pb.Record, config *config.Config) (*db.Record, error)
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.
func ValidateType ¶ added in v0.5.0
ValidateType validates line t to ensure it can be stored in the database.
Types ¶
This section is empty.