structpath

package
v0.0.0-...-4b76e91 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

func ForProto

func ForProto(proto proto.Message) *Instance

ForProto creates a structpath Instance by marshaling the proto to JSON and then evaluating over that structure. This is the most generally useful form as serialization to JSON also automatically converts proto.Any and proto.Struct to the serialized JSON forms which can then be evaluated over. The downside is the loss of type fidelity for numeric types as JSON can only represent floats.

func (*Instance) Check

func (i *Instance) Check() error

Check executes the set of constraints for this selection and returns the first error encountered, or nil if all constraints have been successfully met. All constraints are removed after them check is performed.

func (*Instance) CheckOrFail

func (i *Instance) CheckOrFail(t test.Failer) *Instance

CheckOrFail calls Check on this selection and fails the given test if an error is encountered.

func (*Instance) ContainSubstring

func (i *Instance) ContainSubstring(substr, path string) *Instance

func (*Instance) Equals

func (i *Instance) Equals(expected any, path string, args ...any) *Instance

func (*Instance) Exists

func (i *Instance) Exists(path string, args ...any) *Instance

func (*Instance) NotExists

func (i *Instance) NotExists(path string, args ...any) *Instance

func (*Instance) Select

func (i *Instance) Select(path string, args ...any) *Instance

Jump to

Keyboard shortcuts

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