Documentation ¶
Index ¶
- Variables
- func ExtractIDsFromResult(results ...TopNewsRankerResult) []string
- func GetMongodbCluster(host chan string)
- func GetRedisHost(host chan string)
- func GoogleNewsFindIfExist(URL string, sc *mongodb.Session) bool
- func GoogleNewsInsert(hn GoogleNews, URL string, wg *sync.WaitGroup) bool
- func HackerNewsFindIfExist(title string, sc *mongodb.Session) bool
- func HackerNewsInsert(hn HackerNews, hnTitle string, wg *sync.WaitGroup)
- func IncrementNewsScore(paramsID string)
- func MongodbStart()
- func NewPool(server string) *redis.Pool
- func NewsItemPage(paramsID string) (interface{}, error)
- func SessionCopy() *mongodb.Session
- func StartRedis()
- func TopNewsRanker(from time.Duration, to time.Duration) []string
- type AggregatedNews
- func GetCategorizedNews(initial string) (AggregatedNews, error)
- func GetterNewsMainTopScore() (AggregatedNews, error)
- func GoogleNewsIndexNews() (AggregatedNews, error)
- func HackerNewsFeedMore(contentType string, length int) (AggregatedNews, error)
- func HackerNewsIndexNews() (AggregatedNews, error)
- func HackerNewsLatestNews() (AggregatedNews, error)
- func NewsMainIndexNews() (AggregatedNews, error)
- type GoogleNews
- type HackerNews
- type NewsIds
- type TopNewsRankerResult
Constants ¶
This section is empty.
Variables ¶
var ( // MongodbSession main mongodb connection session MongodbSession *mongodb.Session // Db database name Db = "news_aggregator" )
var (
// NewsMainCollection collection name
NewsMainCollection = "news_main"
)
var ( // RedisPool main redis pool connection RedisPool *redis.Pool )
Functions ¶
func ExtractIDsFromResult ¶
func ExtractIDsFromResult(results ...TopNewsRankerResult) []string
ExtractIDsFromResult utils from extracting IDS from result
func GetMongodbCluster ¶
func GetMongodbCluster(host chan string)
GetMongodbCluster retrieve mongodb cluster node from etcd
func GoogleNewsFindIfExist ¶
GoogleNewsFindIfExist check google news current data if exist before insert
func GoogleNewsInsert ¶
func GoogleNewsInsert(hn GoogleNews, URL string, wg *sync.WaitGroup) bool
GoogleNewsInsert insert data for google news
func HackerNewsFindIfExist ¶
HackerNewsFindIfExist check if data exists already before saving
func HackerNewsInsert ¶
func HackerNewsInsert(hn HackerNews, hnTitle string, wg *sync.WaitGroup)
HackerNewsInsert insert data to mongodb
func IncrementNewsScore ¶
func IncrementNewsScore(paramsID string)
IncrementNewsScore increment news score increment news ite page view
func NewsItemPage ¶
NewsItemPage get news item data
Types ¶
type AggregatedNews ¶
type AggregatedNews []interface{}
AggregatedNews interface struct for AggregatedNews
func GetCategorizedNews ¶
func GetCategorizedNews(initial string) (AggregatedNews, error)
GetCategorizedNews will get news with category news initials
func GetterNewsMainTopScore ¶
func GetterNewsMainTopScore() (AggregatedNews, error)
GetterNewsMainTopScore main top page news getter
func GoogleNewsIndexNews ¶
func GoogleNewsIndexNews() (AggregatedNews, error)
GoogleNewsIndexNews aggregated news list for google news
func HackerNewsFeedMore ¶
func HackerNewsFeedMore(contentType string, length int) (AggregatedNews, error)
HackerNewsFeedMore feed more data on index list
func HackerNewsIndexNews ¶
func HackerNewsIndexNews() (AggregatedNews, error)
HackerNewsIndexNews index page data
func HackerNewsLatestNews ¶
func HackerNewsLatestNews() (AggregatedNews, error)
HackerNewsLatestNews aggregate latest news
func NewsMainIndexNews ¶
func NewsMainIndexNews() (AggregatedNews, error)
NewsMainIndexNews responder for index news query
type NewsIds ¶
NewsIds struct for result IDS only
func NewsIndexNewsIDS ¶
NewsIndexNewsIDS retrieve all news index ids and save to cache