Documentation ¶
Overview ¶
Package suggest contains routines to implement a suggest engine
Package suggest contains routines to implement a suggest engine
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adder ¶
type Adder interface { // Add makes best effort to eventually add s to this instance. Add(s string) }
Adder is the interface for adding to a suggest engine.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents a suggest engine which multiple goroutines may safely use.
func (*Engine) Add ¶
Add implements the Adder interface.
Add returns immediately before s is added. While Add makes best effort to ensure that s is eventually added to this instance, Add makes no guarantee that it will happen.
type Suggester ¶
type Suggester interface { // Suggest returns the strings in this instance that start with q. // If max > 0, then Suggest returns at most max results; otherwise, it // returns all results. Suggest(max int, q string) (result []string) }
Suggester is the interface for all suggest engines
func NewSuggester ¶
NewSuggester returns a Suggester that presents the given suggestions in the same order. NewSuggester takes a defensive copy of suggestions.