database

package
v0.0.0-...-40c35e2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MongodbSession main mongodb cluster session
	MongodbSession *mongodb.Session

	// Db current app database
	Db = "news_aggregator"
)
View Source
var (

	// NewsMainCollection collection name
	NewsMainCollection = "news_main"
)
View Source
var (
	// RedisPool main redis pool connection
	RedisPool *redis.Pool
)

Functions

func GetMongodbCluster

func GetMongodbCluster(host chan string)

GetMongodbCluster retrieve mongodb cluster node from etcd

func GetRedisHost

func GetRedisHost(host chan string)

GetRedisHost get redis host from etcd

func GoogleNewsFindIfExist

func GoogleNewsFindIfExist(title string) bool

GoogleNewsFindIfExist check google news current data if exist before insert

func GoogleNewsInsert

func GoogleNewsInsert(hn GoogleNews, wg *sync.WaitGroup) bool

GoogleNewsInsert insert data for google news

func HackerNewsFindIfExist

func HackerNewsFindIfExist(title string, sc *mongodb.Session) bool

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 MongodbStart

func MongodbStart()

MongodbStart start connecting to mongodb

func NewPool

func NewPool(server string) *redis.Pool

NewPool create redis pool servers

func NewsItemPage

func NewsItemPage(paramsID string) (interface{}, error)

NewsItemPage get news item data

func NewsMainIndexNews

func NewsMainIndexNews(language string) ([]models.NewsMaster, error)

NewsMainIndexNews responder for index news query NEWS MAIN GETTER

func RedisKeyGen

func RedisKeyGen(keys ...string) string

RedisKeyGen is a util that joins slices to string

func RetrieveSessionKey

func RetrieveSessionKey(cookieKey string)

RetrieveSessionKey get session key from redis

func SessionCopy

func SessionCopy() *mongodb.Session

SessionCopy make copy of a mongodb session

func SetSessionKey

func SetSessionKey(encodedKey string) bool

SetSessionKey main session key setter to redis

func StartRedis

func StartRedis()

StartRedis start connecting to redis

func SubstringStrToKey

func SubstringStrToKey(str string, keyLength int) string

SubstringStrToKey get a key from string by range

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 HeadlinesGetter

func HeadlinesGetter() (AggregatedNews, error)

HeadlinesGetter retrive data from mongodb

func NewsMainIndexNewsCached

func NewsMainIndexNewsCached(IDs ...bson.ObjectId) (AggregatedNews, error)

NewsMainIndexNewsCached retrieve index news from cached ID TODO make this func a util!

func SuggestRand

func SuggestRand() (AggregatedNews, error)

SuggestRand retrieve curated top ranking news fom cache

func TopRankingNews

func TopRankingNews() (AggregatedNews, error)

TopRankingNews retrieve curated top ranking news fom cache

type GoogleNews

type GoogleNews interface{}

GoogleNews interface for google news

type HackerNews

type HackerNews interface{}

HackerNews interface for hn news item

type Rstring

type Rstring struct {
	Key   string `bson:"key"`
	Value string `bson:"value"`
}

Rstring struct for single KV

func (*Rstring) Get

func (r *Rstring) Get() (reply interface{}, err error)

Get retrieve single KEY Value

func (*Rstring) Set

func (r *Rstring) Set() (reply interface{}, err error)

Set insert to redis single KEY Value

Jump to

Keyboard shortcuts

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