textlist

package
v0.0.0-...-cf07509 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterList

func FilterList(
	in_list []string,
	filters Filters,
	functions FilterFunctions,
	data map[string]interface{},
) (
	[]string,
	error,
)

Filters subject date passed by in_list, with filter set passed by filters. functions should contain functions asked by filters. data - additional data to pass to functions

func RemoveDuplicatedStrings

func RemoveDuplicatedStrings(in []string) []string

func RemoveZeroLengthItems

func RemoveZeroLengthItems(in []string) []string

Types

type FilterFunctions

type FilterFunctions map[string]func(
	parameter string,
	case_sensitive bool,
	value_to_match string,
	data map[string]interface{},
) (bool, error)

create functions for FilterList(). parameter - parameter defined in filter and passed to function case_sensitive - if function must take case into account value_to_match - value which function have to check data - can be user to pass some additional data to functions

type FilterItem

type FilterItem struct {
	// if [function result]+[NotFunc] == true.
	// if Add == true, then value which is chacked by this filter item,
	// considered to be added to result,
	// else, if Add == false, - item should be removed from result
	Add bool

	// apply boolean not to function result
	NotFunc bool

	// name of function, which FilterList have to use
	Func string

	// if function have to be case sensetive
	CaseSensitive bool

	// some functioning data, to be passed to function
	FuncParam string
}

structure for one of items of filter text parse result

type Filters

type Filters []*FilterItem

func ParseFilterText

func ParseFilterText(text string) (Filters, error)

func ParseFilterTextLines

func ParseFilterTextLines(text []string) (Filters, error)

func ParseFilterTextLinesMust

func ParseFilterTextLinesMust(text []string) Filters

func ParseFilterTextMust

func ParseFilterTextMust(text string) Filters

Jump to

Keyboard shortcuts

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