Documentation ¶
Overview ¶
Package presentation prints results of an expression evaluation in json and tabular formats.
Index ¶
- Variables
- func Bindings(w io.Writer, r Output) error
- func Discard(w io.Writer, x interface{}) error
- func JSON(w io.Writer, x interface{}) error
- func Pretty(w io.Writer, r Output) error
- func PrettyWithOptions(w io.Writer, r Output, opts PrettyOptions) error
- func Raw(w io.Writer, r Output) error
- func Source(w io.Writer, r Output) error
- func Values(w io.Writer, r Output) error
- type DepAnalysisOutput
- type Output
- type OutputError
- type OutputErrors
- type PrettyOptions
Constants ¶
This section is empty.
Variables ¶
var DefaultProfileSortOrder = []string{"total_time_ns", "num_eval", "num_redo", "file", "line"}
DefaultProfileSortOrder is the default ordering unless something is specified in the CLI
Functions ¶
func PrettyWithOptions ¶ added in v0.66.0
func PrettyWithOptions(w io.Writer, r Output, opts PrettyOptions) error
PrettyWithOptions prints all of r to w in a human-readable format.
func Raw ¶ added in v0.27.0
Raw prints the values from r to w. Each result is written on a separate line, and the expressions are separated by spaces. If the values are strings, they are written directly rather than formatted as compact JSON strings. This output format makes OPA useful in a scripting context.
Types ¶
type DepAnalysisOutput ¶ added in v0.9.2
type DepAnalysisOutput struct { Base []ast.Ref `json:"base,omitempty"` Virtual []ast.Ref `json:"virtual,omitempty"` }
DepAnalysisOutput contains the result of dependency analysis to be presented.
type Output ¶
type Output struct { Errors OutputErrors `json:"errors,omitempty"` Result rego.ResultSet `json:"result,omitempty"` Partial *rego.PartialQueries `json:"partial,omitempty"` Metrics metrics.Metrics `json:"metrics,omitempty"` AggregatedMetrics map[string]interface{} `json:"aggregated_metrics,omitempty"` Explanation []*topdown.Event `json:"explanation,omitempty"` Profile []profiler.ExprStats `json:"profile,omitempty"` AggregatedProfile []profiler.ExprStatsAggregated `json:"aggregated_profile,omitempty"` Coverage *cover.Report `json:"coverage,omitempty"` // contains filtered or unexported fields }
Output contains the result of evaluation to be presented.
type OutputError ¶ added in v0.15.0
type OutputError struct { Message string `json:"message"` Code string `json:"code,omitempty"` Location *ast.Location `json:"location,omitempty"` Details interface{} `json:"details,omitempty"` // contains filtered or unexported fields }
OutputError provides a common structure for all OPA library errors so that the JSON output given by the presentation package is consistent and parsable.
func NewOutputErrors ¶ added in v0.15.0
func NewOutputErrors(err error) []OutputError
NewOutputErrors creates a new slice of OutputError's based on the type of error passed in. Known structured types will be translated as appropriate, while unknown errors are placed into a structured format with their string value.
func (OutputError) Error ¶ added in v0.15.0
func (j OutputError) Error() string
type OutputErrors ¶ added in v0.15.0
type OutputErrors []OutputError
OutputErrors is a list of errors encountered which are to presented.
func (OutputErrors) Error ¶ added in v0.15.0
func (e OutputErrors) Error() string
type PrettyOptions ¶ added in v0.66.0
type PrettyOptions struct {
TraceOpts topdown.PrettyTraceOptions
}