model

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

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Id       bson.ObjectId `bson:"_id"`
	Votes    int           `bson:"votes"`
	Answers  int           `bson:"answers"`
	Views    int           `bson:"views"`
	Url      string        `bson:"url"`
	Question string        `bson:"question"`
}

type Mgo

type Mgo struct {
	Session *mgo.Session
	DB      *mgo.Database
	MgoHost string
	MgoDB   string
}

func InitMgoDB

func InitMgoDB(ConnStr, DBName string) *Mgo

func (*Mgo) Close

func (mgo *Mgo) Close()

func (*Mgo) DeleteUrl

func (mgo *Mgo) DeleteUrl(url Url) error

func (*Mgo) InsertItems

func (mgo *Mgo) InsertItems(items []Item) (err error)

func (*Mgo) InsertUrls

func (mgo *Mgo) InsertUrls(urls []string) (err error)

func (*Mgo) QueryUrls

func (mgo *Mgo) QueryUrls(topN int) ([]Url, error)

type RedisMq

type RedisMq struct {
	RedisClient *redis.Pool

	Mgo *Mgo
	C   redis.Conn
	// contains filtered or unexported fields
}

func InitRedisMq

func InitRedisMq(redisHost string, redisDB int) (*RedisMq, error)

func (*RedisMq) GetUrls

func (rmq *RedisMq) GetUrls(jobChan chan string)

func (*RedisMq) LoadUrlsFromRedis

func (rmq *RedisMq) LoadUrlsFromRedis(jobChan chan string)

* this function is likely a producter.

func (*RedisMq) PushUrl

func (rmq *RedisMq) PushUrl(url Url)

type Url

type Url struct {
	Id  bson.ObjectId `bson:"_id"`
	Url string        `json:"url"`
}

Jump to

Keyboard shortcuts

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