hubspider

package
v0.0.0-...-26eea9c Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureSnapshotsIndices

func EnsureSnapshotsIndices(s *mgo.Session, DBNAME string) error

Types

type Contributor

type Contributor struct {
	Avatar   string `bson:"avatar" json:"avatar"`
	Username string `bson:"username" json:"username"`
}

type Contributors

type Contributors []Contributor

type HubSpider

type HubSpider struct {
	URL    string
	Parent bool
	Lang   string
	DB     *mgo.Database
}

func New

func New(db *mgo.Database, languages []string) *HubSpider

func NewLanguageSpider

func NewLanguageSpider(lang string) *HubSpider

func (*HubSpider) SaveAll

func (h *HubSpider) SaveAll(ctx *spider.Context) error

func (*HubSpider) Setup

func (h *HubSpider) Setup(parent *spider.Context) (*spider.Context, error)

func (*HubSpider) Spin

func (h *HubSpider) Spin(ctx *spider.Context) error

type Repo

type Repo struct {
	Name        string       `bson:"name" json:"name"`
	Description string       `bson:"description" json:"description"`
	URL         string       `bson:"url" json:"url"`
	Owner       string       `bson:"owner" json:"owner"`
	BuiltBy     Contributors `bson:"built_by" json:"built_by"`
}

type Repos

type Repos []*Repo

func ParseHTMLToRepos

func ParseHTMLToRepos(doc *goquery.Document) (Repos, error)

type Snapshot

type Snapshot struct {
	Date      string           `bson:"date" json:"date"`
	Languages map[string]Repos `bson:"languages" json:"languages"`
}

func FindSnapshotByTime

func FindSnapshotByTime(db *mgo.Database, date time.Time) (*Snapshot, error)

func NewSnapshot

func NewSnapshot(langs map[string]Repos) *Snapshot

func (*Snapshot) Save

func (s *Snapshot) Save(db *mgo.Database) error

func (*Snapshot) ServeJSON

func (s *Snapshot) ServeJSON(w http.ResponseWriter, r *http.Request)

func (*Snapshot) ToJSON

func (s *Snapshot) ToJSON() string

func (*Snapshot) Upsert

func (s *Snapshot) Upsert(db *mgo.Database, query interface{}) error

Jump to

Keyboard shortcuts

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