search

package
v0.0.0-...-0d2c1c8 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Display

func Display(results chan *Result)

Display从每个单独的goroutine接收到结果后在终端窗口输出

func Match

func Match(matcher Matcher, feed *Feed, searchTerm string, results chan<- *Result)

Match函数,为每个数据源单独启动goroutine来执行这个函数;并发地执行搜索

func Register

func Register(feedType string, matcher Matcher)

Register调用时,会注册一个匹配器,提供给后面的程序使用

func Run

func Run(searchTerm string)

Run执行搜索逻辑

Types

type Feed

type Feed struct {
	Name string `json:"site"`
	URI  string `josn:"link"`
	Type string `json:"type"`
}

Feed包含我们需要处理的数据源的信息

func RetrieveFeeds

func RetrieveFeeds() ([]*Feed, error)

RetrieveFeeds读取并反序列化源数据文件

type Matcher

type Matcher interface {
	Search(feed *Feed, searchTerm string) ([]*Result, error)
}

Matcher定义了要实现的新搜索类型的行为

type Result

type Result struct {
	Field   string
	Content string
}

Result保存搜索的结果

Jump to

Keyboard shortcuts

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