Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completion ¶
Completion is the signature of a function supporting simple 1..n suggestions
func LevenshteinDistance ¶
func LevenshteinDistance(data []string, options ...LevenshteinDistanceOpt) Completion
LevenshteinDistance is a function
func StartsWith ¶
func StartsWith(data []string, options ...StartsWithOpt) Completion
StartsWith takes a slice of strings (data) and returns a function (Completion). The Completion function takes a string (search query) and returns all strings from data that start with the search query. The search is configured by StartsWithOpt-functional options. By default, the minimum length of the search query is 3.
type LevenshteinDistanceOpt ¶
type LevenshteinDistanceOpt func(o *ldOpts)
LevenshteinDistanceOpt is a set of options for use with LevenshteinDistance
func LevenshteinDistanceIgnoreCase ¶
func LevenshteinDistanceIgnoreCase(ignoreCase bool) LevenshteinDistanceOpt
LevenshteinDistanceIgnoreCase returns a LevenshteinDistanceOpt that sets the ignoreCase property on an ldOpts instance.
Parameters:
- ignoreCase (bool): is the flag to determine whether to ignore case.
Returns: a function that accepts an internal option instance and sets its ignoreCase.
func LevenshteinDistanceMax ¶
func LevenshteinDistanceMax(maximum int) LevenshteinDistanceOpt
LevenshteinDistanceMax returns a LevenshteinDistanceOpt that sets the maximum Levenshtein distance on an ldOpts instance.
Parameters:
- maximum (int): is the maximum distance value.
Returns: a function that accepts an internal option instance and sets its maxDistance.
func LevenshteinDistanceMin ¶
func LevenshteinDistanceMin(minimum int) LevenshteinDistanceOpt
LevenshteinDistanceMin returns a LevenshteinDistanceOpt that sets the minimum Levenshtein distance on an ldOpts instance.
Parameters:
- minimum (int): is the minimum distance value.
Returns: a function that accepts an internal option instance and sets its minDistance.
type StartsWithOpt ¶
type StartsWithOpt func(o *swOpts)
StartsWithOpt represents a function type that manipulates an internal options configuration.
func StartsWithMin ¶
func StartsWithMin(minimum int) StartsWithOpt
StartsWithMin returns a StartsWithOpt function that modifies the minimum string length of the internal options configuration.