Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("repository not found")
ErrNotFound is returned when a Repository was not found
Functions ¶
func GitHubHandler ¶
func GitHubHandler(repositories Service, tmpl *template.Template, notfoundTmpl *template.Template) http.HandlerFunc
GitHubHandler renders and responds with a html page to a http request
Types ¶
type GitHub ¶
type GitHub struct {
// contains filtered or unexported fields
}
GitHub makes API calls to GitHub
func NewGitHubClient ¶
NewGitHubClient initializes a new GitHub client from a token
type GoDoc ¶
type GoDoc struct {
// contains filtered or unexported fields
}
GoDoc scrapes godoc.org
type Repository ¶
type Repository struct { URL string Description string Updated time.Time CurrentVersion Version License License Statistics []Statistic Topics []Topic Versions []Version }
Repository is a software repository containing Go code.
type Service ¶
type Service interface { Get(ctx context.Context, url string) (Repository, error) Homepage(ctx context.Context) (Homepage, error) }
Service is an interface which should implement the actual business logic for repositories.
func NewMetricService ¶
NewMetricService creates Service which wraps its methods with metrics
type Storage ¶
type Storage interface { Get(ctx context.Context, url string) (Repository, error) GetPopular(ctx context.Context, limit int) ([]string, error) GetLatest(ctx context.Context, limit int) ([]string, error) GetRandom(ctx context.Context, limit int) ([]string, error) Exists(ctx context.Context, url string) (bool, error) Create(ctx context.Context, repo Repository) error }
Storage is an interface which implementation should actually store and retrieve repositories.
func NewPostgresStorage ¶
NewPostgresStorage returns a Storage implementation using Postgres.
Click to show internal directories.
Click to hide internal directories.