report

package
v3.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Breakdown

type Breakdown struct {
	SubCheck string    `json:"sub_check"`
	Result   string    `json:"result"`
	Details  []*detail `json:"details"`
}

Breakdown describes a breakdown on check

type BreakdownBuilder

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

BreakdownBuilder builds a Breakdown

Example
breakdown, err := NewBreakdownBuilder().
	WithSubCheck("some_sub_check").
	WithResult("some_result").
	WithDetail("some_name", "some_value").
	Build()
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(breakdown)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"sub_check":"some_sub_check","result":"some_result","details":[{"name":"some_name","value":"some_value"}]}
Example (Minimal)
breakdown, err := NewBreakdownBuilder().
	WithSubCheck("some_sub_check").
	WithResult("some_result").
	Build()
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(breakdown)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"sub_check":"some_sub_check","result":"some_result","details":[]}

func NewBreakdownBuilder

func NewBreakdownBuilder() *BreakdownBuilder

NewBreakdownBuilder creates a new BreakdownBuilder

func (*BreakdownBuilder) Build

func (b *BreakdownBuilder) Build() (*Breakdown, error)

Build creates a new Breakdown

func (*BreakdownBuilder) WithDetail

func (b *BreakdownBuilder) WithDetail(name string, value string) *BreakdownBuilder

WithDetail sets the Detail of a Breakdown

func (*BreakdownBuilder) WithResult

func (b *BreakdownBuilder) WithResult(result string) *BreakdownBuilder

WithResult sets the result of a Breakdown

func (*BreakdownBuilder) WithSubCheck

func (b *BreakdownBuilder) WithSubCheck(subCheck string) *BreakdownBuilder

WithSubCheck sets the sub check of a Breakdown

type Recommendation

type Recommendation struct {
	Value              string `json:"value"`
	Reason             string `json:"reason,omitempty"`
	RecoverySuggestion string `json:"recovery_suggestion,omitempty"`
}

Recommendation describes a recommendation on check

type RecommendationBuilder

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

RecommendationBuilder builds a Recommendation

Example
recommendation, err := NewRecommendationBuilder().
	WithReason("some_reason").
	WithValue("some_value").
	WithRecoverySuggestion("some_suggestion").
	Build()
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(recommendation)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"value":"some_value","reason":"some_reason","recovery_suggestion":"some_suggestion"}
Example (Minimal)
recommendation, err := NewRecommendationBuilder().
	WithValue("some_value").
	Build()
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

data, err := json.Marshal(recommendation)
if err != nil {
	fmt.Printf("error: %s", err.Error())
	return
}

fmt.Println(string(data))
Output:

{"value":"some_value"}

func NewRecommendationBuilder

func NewRecommendationBuilder() *RecommendationBuilder

NewRecommendationBuilder creates a new RecommendationBuilder

func (*RecommendationBuilder) Build

Build creates a new Recommendation

func (*RecommendationBuilder) WithReason

func (b *RecommendationBuilder) WithReason(reason string) *RecommendationBuilder

WithReason sets the reason of a Recommendation

func (*RecommendationBuilder) WithRecoverySuggestion

func (b *RecommendationBuilder) WithRecoverySuggestion(recoverySuggestion string) *RecommendationBuilder

WithRecoverySuggestion sets the recovery suggestion of a Recommendation

func (*RecommendationBuilder) WithValue

func (b *RecommendationBuilder) WithValue(value string) *RecommendationBuilder

WithValue sets the value of a Recommendation

Jump to

Keyboard shortcuts

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