search

package
v0.0.0-...-c576ecb Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2017 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)

Types

type Feed

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

Feed contains information we need to process a feed.

func RetrieveFeeds

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

RetrieveFeeds reads and unmarshals the feed data file.

type Matcher

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

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