Documentation ¶
Overview ¶
Package qaengine contains the types used for the question answering part of the CLI.
Index ¶
- Constants
- type Cache
- type CacheSpec
- type Config
- type Problem
- func NewConfirmProblem(probid, desc string, context []string, def bool) (p Problem, err error)
- func NewInputProblem(probid, desc string, context []string, def string) (p Problem, err error)
- func NewMultiSelectProblem(probid, desc string, context []string, def []string, opts []string) (p Problem, err error)
- func NewMultilineInputProblem(probid, desc string, context []string, def string) (p Problem, err error)
- func NewPasswordProblem(probid, desc string, context []string) (p Problem, err error)
- func NewSelectProblem(probid, desc string, context []string, def string, opts []string) (p Problem, err error)
- type SolutionForm
- type SolutionFormType
- type Store
Constants ¶
const (
// OtherAnswer - Use as one of the answers, when there is a option to enter the answer in Select Question Type
OtherAnswer = "Other (specify custom option)"
)
const QACacheKind types.Kind = "QACache"
QACacheKind defines kind of QA Cache
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { types.TypeMeta `yaml:",inline"` types.ObjectMeta `yaml:"metadata,omitempty"` Spec CacheSpec `yaml:"spec,omitempty"` }
Cache stores the answers for reuse
func (*Cache) AddSolution ¶ added in v0.2.0
AddSolution adds a problem to solution cache
func (*Cache) GetSolution ¶
GetSolution reads a solution for the problem
type CacheSpec ¶
type CacheSpec struct { // Problems stores the list of problems with resolutions Problems []Problem `yaml:"solutions"` // contains filtered or unexported fields }
CacheSpec stores the cache data
type Config ¶ added in v0.2.0
type Config struct { OutputPath string // contains filtered or unexported fields }
Config stores the answers in a yaml file
func NewConfig ¶ added in v0.2.0
NewConfig creates a new config instance given config strings and paths to config files
func (*Config) AddSolution ¶ added in v0.2.0
AddSolution adds a problem to the config
func (*Config) GetSolution ¶ added in v0.2.0
GetSolution reads a solution from the config
type Problem ¶
type Problem struct { ID string `yaml:"id,omitempty" json:"id,omitempty"` Desc string `yaml:"description,omitempty" json:"description,omitempty"` Context []string `yaml:"context,omitempty" json:"context,omitempty"` Solution SolutionForm `yaml:"solution" json:"solution,omitempty"` Resolved bool `yaml:"resolved,omitempty" json:"resolved,omitempty"` }
Problem defines the QA problem
func NewConfirmProblem ¶
NewConfirmProblem creates a new instance of confirm problem
func NewInputProblem ¶
NewInputProblem creates a new instance of input problem
func NewMultiSelectProblem ¶
func NewMultiSelectProblem(probid, desc string, context []string, def []string, opts []string) (p Problem, err error)
NewMultiSelectProblem creates a new instance of multiselect problem
func NewMultilineInputProblem ¶
func NewMultilineInputProblem(probid, desc string, context []string, def string) (p Problem, err error)
NewMultilineInputProblem creates a new instance of multiline input problem
func NewPasswordProblem ¶
NewPasswordProblem creates a new instance of password problem
func NewSelectProblem ¶
func NewSelectProblem(probid, desc string, context []string, def string, opts []string) (p Problem, err error)
NewSelectProblem creates a new instance of select problem
func (*Problem) GetBoolAnswer ¶
GetBoolAnswer returns a bool as answer if the solution type supports it
func (*Problem) GetSliceAnswer ¶
GetSliceAnswer returns a slice as answer if the solution type supports it
func (*Problem) GetStringAnswer ¶
GetStringAnswer returns a string as answer if the solution type supports it
type SolutionForm ¶
type SolutionForm struct { Type SolutionFormType `yaml:"type,omitempty" json:"type,omitempty"` Default []string `yaml:"default,omitempty" json:"default,omitempty"` Options []string `yaml:"options,omitempty" json:"options,omitempty"` Answer []string `yaml:"answer" json:"answer"` }
SolutionForm defines the solution
type SolutionFormType ¶
type SolutionFormType string
SolutionFormType is the type that defines different types of solutions possible
const ( // SelectSolutionFormType defines a single select solution type SelectSolutionFormType SolutionFormType = "Select" // MultiSelectSolutionFormType defines a multi-select solution type MultiSelectSolutionFormType SolutionFormType = "MultiSelect" // InputSolutionFormType allows single line user input InputSolutionFormType SolutionFormType = "Input" // MultilineSolutionFormType allows multiple user input MultilineSolutionFormType SolutionFormType = "MultiLine" // PasswordSolutionFormType allows password entry PasswordSolutionFormType SolutionFormType = "Password" // ConfirmSolutionFormType allows yes/no answers ConfirmSolutionFormType SolutionFormType = "Confirm" )