result

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

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

Result is returned from a `Spec.Run` execution. It serves two purposes: 1) to return the error, if any, from the Run execution and 2) to pass back information about the Run that can be injected into the context's `PriorRun` cache. Some plugins, e.g. the gdt-http plugin, use cached data from a previous run in order to construct current Run fixtures. In the case of the gdt=http plugin, the previous `nethttp.Response` is returned in the Result and the `Scenario.Run` method injects that information into the context that is supplied to the next Spec's `Run`.

func New

func New(mods ...ResultModifier) *Result

New returns a new Result

func (*Result) Data

func (r *Result) Data() map[string]interface{}

Data returns the raw run data saved in the result

func (*Result) Error

func (r *Result) Error() string

Error implements the error interface.

func (*Result) HasData

func (r *Result) HasData() bool

HasData returns true if any of the run data has been set, false otherwise.

func (*Result) SetData

func (r *Result) SetData(
	key string,
	val interface{},
)

SetData sets a value in the result's run data cache.

func (*Result) Unwrap

func (r *Result) Unwrap() error

Unwrap returns the wrapped error

type ResultModifier

type ResultModifier func(*Result)

func WithData

func WithData(key string, val interface{}) ResultModifier

WithData modifies the Result with the supplied run data key and value

func WithError

func WithError(err error) ResultModifier

WithError modifies the Result with the supplied error

Jump to

Keyboard shortcuts

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