summaryrefslogtreecommitdiff
path: root/predict
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2019-11-22 15:03:53 +0200
committerEyal Posener <[email protected]>2019-11-22 15:03:53 +0200
commita138e3dfcfa3b2a3b03e257ba5a2ae0902d91b2c (patch)
treeb86e1c450aa67188eef86f3738c9b3a14bc5343c /predict
parenta48bf3f8566559660c11fa0f08a09914a37214f1 (diff)
Options: added docs
Diffstat (limited to 'predict')
-rw-r--r--predict/options.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/predict/options.go b/predict/options.go
index 8d88b54..5bfbac4 100644
--- a/predict/options.go
+++ b/predict/options.go
@@ -41,11 +41,13 @@ func OptCheck() Option {
}
}
+// Config stores prediction options.
type Config struct {
complete.Predictor
check bool
}
+// Options return a config from a list of options.
func Options(os ...Option) Config {
var op Config
for _, f := range os {
@@ -61,6 +63,8 @@ func (c Config) Predict(prefix string) []string {
return nil
}
+// Check checks that value is one of the predicted values, in case
+// that the check field was set.
func (c Config) Check(value string) error {
if !c.check || c.Predictor == nil {
return nil