Exemple #1
0
func newEntryFilter(s string) functional.Filterer {
	s = str_util.Normalize(s)
	if s == "" {
		return functional.All()
	}
	return entryFilter(s)
}
Exemple #2
0
func (f entryFilter) Filter(ptr interface{}) error {
	p := ptr.(*vsafe.Entry)
	pattern := string(f)
	if p.Url != nil {
		str := str_util.Normalize(p.Url.String())
		if strings.Index(str, pattern) != -1 {
			return nil
		}
	}
	if strings.Index(str_util.Normalize(p.Title), pattern) != -1 {
		return nil
	}
	if strings.Index(str_util.Normalize(p.Desc), pattern) != -1 {
		return nil
	}
	return functional.Skipped
}