qaengine

package
v0.2.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCaches

func AddCaches(cacheFiles []string)

AddCaches adds cache responders. Later cache files override earlier cache files. [base.yaml, project.yaml, service.yaml]

func AddEngine

func AddEngine(e Engine)

AddEngine appends an engine to the engines slice

func AddEngineHighestPriority added in v0.2.0

func AddEngineHighestPriority(e Engine) error

AddEngineHighestPriority adds an engine to the list and sets it at highest priority

func FetchAnswer

func FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer for the question

func FetchBoolAnswer added in v0.2.0

func FetchBoolAnswer(probid, desc string, context []string, def bool) bool

FetchBoolAnswer asks a confirm type question and gets a boolean as the answer

func FetchMultiSelectAnswer added in v0.2.0

func FetchMultiSelectAnswer(probid, desc string, context, def, options []string) []string

FetchMultiSelectAnswer asks a multi-select type question and gets a slice of strings as the answer

func FetchMultilineAnswer added in v0.2.0

func FetchMultilineAnswer(probid, desc string, context []string, def string) string

FetchMultilineAnswer asks a multi-line type question and gets a string as the answer

func FetchPasswordAnswer added in v0.2.0

func FetchPasswordAnswer(probid, desc string, context []string) string

FetchPasswordAnswer asks a password type question and gets a string as the answer

func FetchSelectAnswer added in v0.2.0

func FetchSelectAnswer(probid, desc string, context []string, def string, options []string) string

FetchSelectAnswer asks a select type question and gets a string as the answer

func FetchStringAnswer added in v0.2.0

func FetchStringAnswer(probid, desc string, context []string, def string) string

FetchStringAnswer asks a input type question and gets a string as the answer

func SetupCacheFile added in v0.2.0

func SetupCacheFile(outputPath string, cacheFiles []string)

SetupCacheFile adds cache responders

func SetupConfigFile added in v0.2.0

func SetupConfigFile(outputPath string, configStrings, configFiles, presets []string)

SetupConfigFile adds config responders - should be called only once

func StartEngine

func StartEngine(qaskip bool, qaport int, qadisablecli bool)

StartEngine starts the QA Engines

func ValidateProblem added in v0.2.0

func ValidateProblem(prob qatypes.Problem) error

ValidateProblem validates the problem object.

func WriteStoresToDisk added in v0.2.0

func WriteStoresToDisk() error

WriteStoresToDisk forces all the stores to write their contents out to disk

Types

type CliEngine

type CliEngine struct {
}

CliEngine handles the CLI based qa

func (*CliEngine) FetchAnswer

func (c *CliEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer using cli

func (*CliEngine) IsInteractiveEngine added in v0.2.0

func (*CliEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*CliEngine) StartEngine

func (*CliEngine) StartEngine() error

StartEngine starts the cli engine

type DefaultEngine

type DefaultEngine struct {
}

DefaultEngine returns default values for all questions

func NewDefaultEngine

func NewDefaultEngine() *DefaultEngine

NewDefaultEngine creates a new instance of default engine

func (*DefaultEngine) FetchAnswer

func (*DefaultEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the default answers

func (*DefaultEngine) IsInteractiveEngine added in v0.2.0

func (*DefaultEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*DefaultEngine) StartEngine

func (*DefaultEngine) StartEngine() error

StartEngine starts the default qa engine

type Engine

type Engine interface {
	StartEngine() error
	IsInteractiveEngine() bool
	FetchAnswer(prob qatypes.Problem) (ans qatypes.Problem, err error)
}

Engine defines interface for qa engines

func NewCliEngine

func NewCliEngine() Engine

NewCliEngine creates a new instance of cli engine

func NewHTTPRESTEngine

func NewHTTPRESTEngine(qaport int) Engine

NewHTTPRESTEngine creates a new instance of Http REST engine

type HTTPRESTEngine

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

HTTPRESTEngine handles qa using HTTP REST services

func (*HTTPRESTEngine) FetchAnswer

func (h *HTTPRESTEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer using a REST service

func (*HTTPRESTEngine) IsInteractiveEngine added in v0.2.0

func (*HTTPRESTEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*HTTPRESTEngine) StartEngine

func (h *HTTPRESTEngine) StartEngine() error

StartEngine starts the QA Engine

type StoreEngine added in v0.2.0

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

StoreEngine handles cache

func NewStoreEngineFromCache added in v0.2.0

func NewStoreEngineFromCache(cacheFile string) *StoreEngine

NewStoreEngineFromCache creates a new cache instance

func (*StoreEngine) FetchAnswer added in v0.2.0

func (se *StoreEngine) FetchAnswer(prob qatypes.Problem) (qatypes.Problem, error)

FetchAnswer fetches the answer from the store

func (*StoreEngine) IsInteractiveEngine added in v0.2.0

func (*StoreEngine) IsInteractiveEngine() bool

IsInteractiveEngine returns true if the engine interacts with the user

func (*StoreEngine) StartEngine added in v0.2.0

func (se *StoreEngine) StartEngine() error

StartEngine loads the config from the store

Jump to

Keyboard shortcuts

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