awg

package
v0.0.0-...-deb4dbf Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrScope = "awg"

	ErrCodeContent   = 10
	ErrCodeRatelimit = 11
	ErrCodeNetwork   = 12
)

Variables

This section is empty.

Functions

func SetDefaultLogger

func SetDefaultLogger(logger *zap.Logger)

func Workflow

func Workflow(client *Client, reporter *Reporter, awesomeID github.RepoID,
	ratelimit RateLimit) (
	awesomeRepos map[string][]*AwesomeRepo, err error)

Types

type AwesomeRepo

type AwesomeRepo struct {
	Repo
	AwesomeDesc string `json:"awesome_description"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(client *github.Client) (*Client, error)

New awg client.

func (*Client) Fill

func (c *Client) Fill(ctx context.Context, repo *AwesomeRepo) error

Fill struct repo with more info.

func (*Client) GetHTMLReadme

func (c *Client) GetHTMLReadme(id github.RepoID) (string, error)

Get Readme html page.

func (*Client) GetUser

func (c *Client) GetUser() (*User, error)

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(readme string, client *Client, reporter *Reporter,
	rateLimit RateLimit) *Parser

func (*Parser) FetchRepos

func (p *Parser) FetchRepos(idxReposMap map[string][]*AwesomeRepo) error

Fetch repositories from remote.

func (*Parser) Gather

func (p *Parser) Gather() (map[string][]*AwesomeRepo, error)

Gather repositories from awesome README.md.

func (*Parser) Parse

func (p *Parser) Parse() (map[string][]*html.Node, error)

Get awesome section nodes from awesome README.md

type RateLimit

type RateLimit struct {
	Total     int
	Remaining int
	ResetAt   time.Time
}

type Repo

type Repo struct {
	ID          github.RepoID `json:"id"`
	Owner       string        `json:"owner"`
	AwesomeName string        `json:"awesome_name"`
	Link        string        `json:"link"`
	Watch       int           `json:"watch"`
	Star        int           `json:"star"`
	Fork        int           `json:"fork"`
	LastCommit  time.Time     `json:"last_commit"`
	Description string        `json:"description"`
}

func (*Repo) Aggregate

func (r *Repo) Aggregate(repo *github.Repo) error

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

func (*Reporter) ConReqNum

func (r *Reporter) ConReqNum(num int)

func (*Reporter) Done

func (r *Reporter) Done()

func (*Reporter) GetConReqNum

func (r *Reporter) GetConReqNum() int

func (*Reporter) GetFinishedRepoNum

func (r *Reporter) GetFinishedRepoNum() int

func (*Reporter) GetInvalidRepo

func (r *Reporter) GetInvalidRepo() []github.RepoID

func (*Reporter) GetTotalRepoNum

func (r *Reporter) GetTotalRepoNum() int

func (*Reporter) GetWaitingRepo

func (r *Reporter) GetWaitingRepo() int

func (*Reporter) InvalidRepo

func (r *Reporter) InvalidRepo(id github.RepoID)

func (*Reporter) RepoWaiting

func (r *Reporter) RepoWaiting()

func (*Reporter) TotalRepoNum

func (r *Reporter) TotalRepoNum(num int)

type User

type User struct {
	Name string
	RateLimit
}

Jump to

Keyboard shortcuts

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