Documentation ¶
Index ¶
- Variables
- func NewMarkdownBuilder(opts ...html.Option) render.NodeRenderer
- type MarkdownBuilder
- func (r *MarkdownBuilder) Heading(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
- func (r *MarkdownBuilder) Link(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error)
- func (r *MarkdownBuilder) List(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
- func (r *MarkdownBuilder) ListItem(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
- func (r *MarkdownBuilder) Paragraph(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error)
- func (builder MarkdownBuilder) RegisterFuncs(registerer render.NodeRendererFuncRegisterer)
- func (r *MarkdownBuilder) Table(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
- func (r *MarkdownBuilder) TaskCheckBox(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
- type Risk
- type RiskAnalyzerBuildFunc
- type RiskAnalyzerBuilder
- func (r *RiskAnalyzerBuilder) AddAnswers(answers ...models.WorkloadLensQuestionAnswer) *RiskAnalyzerBuilder
- func (r *RiskAnalyzerBuilder) AddQuestions(questions ...models.Question) *RiskAnalyzerBuilder
- func (s *RiskAnalyzerBuilder) Build(fn RiskAnalyzerBuildFunc) *RiskAnalyzerBuilder
- func (r *RiskAnalyzerBuilder) TotalAnswers() int
- func (r *RiskAnalyzerBuilder) TotalHighRisks() int
- func (r *RiskAnalyzerBuilder) TotalLowRisks() int
- func (r *RiskAnalyzerBuilder) TotalMediumRisks() int
- func (r *RiskAnalyzerBuilder) TotalNoRisk() int
- func (r *RiskAnalyzerBuilder) TotalNotAnswered() int
- func (r *RiskAnalyzerBuilder) TotalNotApplicable() int
- func (r *RiskAnalyzerBuilder) TotalQuestions() int
- type RiskAnalyzerBuilderOpt
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultRiskAnalyzerFunc = func(s *RiskAnalyzerBuilder) error { for _, q := range s.Questions { s.Risks[q.ID] = &Risk{} a, ok := s.Answers[q.ID] if !ok { s.Risks[q.ID].NotAnswered = true continue } env := map[string]bool{ "default": true, } for _, c := range q.Choices { env[string(c.Ref)] = false } for _, c := range a.Choices { env[cast.String(c.Ref)] = true } for _, r := range q.Risks { rule := r.Condition program, err := expr.Compile(rule, expr.Env(env)) if err != nil { return err } output, err := expr.Run(program, env) if err != nil { return err } v, ok := output.(bool) if !ok { return fmt.Errorf("expected bool, got %T", v) } switch r.Risk { case "HIGH_RISK": s.Risks[q.ID].High = v case "MEDIUM_RISK": s.Risks[q.ID].Medium = v case "LOW_RISK": s.Risks[q.ID].Low = v case "NO_RISK": s.Risks[q.ID].NoRisk = v } if v { break } } } return nil }
DefaultRiskAnalyzerFunc ... nolint:gocyclo
View Source
var HeadingClasses = map[int]string{
0: "text-5xl font-bold py-4",
1: "text-4xl font-bold py-4",
2: "text-3xl font-bold py-4",
3: "text-2xl font-bold py-4",
4: "text-xl font-bold py-4",
5: "text-lg font-bold py-4",
6: "text-base font-bold py-4",
}
HeadingClasses ...
Functions ¶
func NewMarkdownBuilder ¶
func NewMarkdownBuilder(opts ...html.Option) render.NodeRenderer
NewMarkdownBuilder ...
Types ¶
type MarkdownBuilder ¶
MarkdownBuilder ...
func (*MarkdownBuilder) Heading ¶
func (r *MarkdownBuilder) Heading(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
Heading ...
func (*MarkdownBuilder) Link ¶
func (r *MarkdownBuilder) Link(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error)
Link ...
func (*MarkdownBuilder) List ¶
func (r *MarkdownBuilder) List(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
List ...
func (*MarkdownBuilder) ListItem ¶
func (r *MarkdownBuilder) ListItem(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
ListItem ...
func (*MarkdownBuilder) Paragraph ¶
func (r *MarkdownBuilder) Paragraph(w util.BufWriter, source []byte, n ast.Node, entering bool) (ast.WalkStatus, error)
Paragraph ...
func (MarkdownBuilder) RegisterFuncs ¶
func (builder MarkdownBuilder) RegisterFuncs(registerer render.NodeRendererFuncRegisterer)
func (*MarkdownBuilder) Table ¶
func (r *MarkdownBuilder) Table(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
Table ...
func (*MarkdownBuilder) TaskCheckBox ¶
func (r *MarkdownBuilder) TaskCheckBox(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)
TaskCheckBox ...
type Risk ¶
type Risk struct { // High ... High bool // Medium ... Medium bool // Low ... Low bool // NoRisk ... NoRisk bool // NotApplicable ... NotApplicable bool // NotAnswered ... NotAnswered bool }
Risk ...
type RiskAnalyzerBuildFunc ¶
type RiskAnalyzerBuildFunc func(*RiskAnalyzerBuilder) error
RiskAnalyzerBuildFunc ...
type RiskAnalyzerBuilder ¶
type RiskAnalyzerBuilder struct { Questions map[int]models.Question Answers map[int]models.WorkloadLensQuestionAnswer Risks map[int]*Risk Error error // contains filtered or unexported fields }
RiskAnalyzerBuilder ...
func NewRiskAnalyzerBuilder ¶
func NewRiskAnalyzerBuilder(opts ...RiskAnalyzerBuilderOpt) *RiskAnalyzerBuilder
NewRiskAnalyzerBuilder ...
func (*RiskAnalyzerBuilder) AddAnswers ¶
func (r *RiskAnalyzerBuilder) AddAnswers(answers ...models.WorkloadLensQuestionAnswer) *RiskAnalyzerBuilder
AddAnswers ...
func (*RiskAnalyzerBuilder) AddQuestions ¶
func (r *RiskAnalyzerBuilder) AddQuestions(questions ...models.Question) *RiskAnalyzerBuilder
AddQuestions ...
func (*RiskAnalyzerBuilder) Build ¶
func (s *RiskAnalyzerBuilder) Build(fn RiskAnalyzerBuildFunc) *RiskAnalyzerBuilder
Build ...
func (*RiskAnalyzerBuilder) TotalAnswers ¶
func (r *RiskAnalyzerBuilder) TotalAnswers() int
TotalAnswers ...
func (*RiskAnalyzerBuilder) TotalHighRisks ¶
func (r *RiskAnalyzerBuilder) TotalHighRisks() int
TotalHighRisks ...
func (*RiskAnalyzerBuilder) TotalLowRisks ¶
func (r *RiskAnalyzerBuilder) TotalLowRisks() int
TotalLowRisks ...
func (*RiskAnalyzerBuilder) TotalMediumRisks ¶
func (r *RiskAnalyzerBuilder) TotalMediumRisks() int
TotalMediumRisks ...
func (*RiskAnalyzerBuilder) TotalNoRisk ¶
func (r *RiskAnalyzerBuilder) TotalNoRisk() int
TotalNoRisk ...
func (*RiskAnalyzerBuilder) TotalNotAnswered ¶
func (r *RiskAnalyzerBuilder) TotalNotAnswered() int
TotalNotAnswered ...
func (*RiskAnalyzerBuilder) TotalNotApplicable ¶
func (r *RiskAnalyzerBuilder) TotalNotApplicable() int
TotalNotApplicable ...
func (*RiskAnalyzerBuilder) TotalQuestions ¶
func (r *RiskAnalyzerBuilder) TotalQuestions() int
TotalQuestions ...
type RiskAnalyzerBuilderOpt ¶
type RiskAnalyzerBuilderOpt func(*RiskAnalyzerBuilder)
RiskAnalyzerBuilderOpt ...
Click to show internal directories.
Click to hide internal directories.