Documentation ¶
Index ¶
- Constants
- type KV
- type Star
- type StarManager
- func (s *StarManager) ClearCache() error
- func (s *StarManager) GetRandomProjects(count int, language, topic string) ([]Star, error)
- func (s *StarManager) GetTopics() []KV
- func (s *StarManager) RemoveOlderThan(months int) error
- func (s *StarManager) RemoveStar(star *Star, wg *sync.WaitGroup) (bool, error)
- func (s *StarManager) SaveAllStars() (bool, error)
- func (s *StarManager) SaveIfEmpty()
- func (s *StarManager) SaveStarredPage(pageno int, responses chan *github.Response, wg *sync.WaitGroup) chan error
- func (s *StarManager) SaveStarredRepository(repo *github.Repository, wg *sync.WaitGroup) error
Constants ¶
const GITHUB string = "api.github.com"
GITHUB - the GitHub API host
const PAGESIZE int = 100
PAGESIZE - the default response page size (GitHub maximum is 100 so we use that)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KV ¶ added in v0.2.0
KV is a generic struct that maintains a string key - int value pair ( :( ).
type Star ¶
type Star struct { PushedAt time.Time `storm:"index"` URL string `storm:"id,index,unique"` Language string `storm:"index"` Stargazers int Description string `storm:"index"` Topics []string `storm:"index"` }
Star represents the starred project that is saved locally
type StarManager ¶
type StarManager struct { Username string Password string Context context.Context Client *github.Client DB *storm.DB }
StarManager - the main object that manages a GitHub user's stars
func (*StarManager) ClearCache ¶
func (s *StarManager) ClearCache() error
ClearCache resets the local db.
func (*StarManager) GetRandomProjects ¶
func (s *StarManager) GetRandomProjects(count int, language, topic string) ([]Star, error)
GetRandomProjects returns random projects given a project count to return, and an optional language and topic to filter by.
func (*StarManager) GetTopics ¶
func (s *StarManager) GetTopics() []KV
GetTopics returns topics for a repository, otherwise if no repository is passed, returns a list of all topics
func (*StarManager) RemoveOlderThan ¶
func (s *StarManager) RemoveOlderThan(months int) error
RemoveOlderThan removes stars older than a specified time
func (*StarManager) RemoveStar ¶
RemoveStar unstars the project on Github and removes the star from the local cache.
func (*StarManager) SaveAllStars ¶
func (s *StarManager) SaveAllStars() (bool, error)
SaveAllStars saves all stars.
func (*StarManager) SaveIfEmpty ¶
func (s *StarManager) SaveIfEmpty()
SaveIfEmpty saves all stars if the local cache is empty
func (*StarManager) SaveStarredPage ¶
func (s *StarManager) SaveStarredPage(pageno int, responses chan *github.Response, wg *sync.WaitGroup) chan error
SaveStarredPage saves an entire page of starred repositories concurrently, optionally sending server responses to a channel if it is provided.
func (*StarManager) SaveStarredRepository ¶
func (s *StarManager) SaveStarredRepository(repo *github.Repository, wg *sync.WaitGroup) error
SaveStarredRepository saves a single starred project to the local cache.