Documentation
¶
Index ¶
- func EnrichRepositoryTrends(repos map[string][]Repository, snapshotDir string, capturedAt time.Time) error
- func MatchesSection(requested, actual string) bool
- func SaveSnapshot(repos map[string][]Repository, dir string, capturedAt time.Time) (string, error)
- func ThinSnapshots(dir string, now time.Time, retentionDays int) error
- type AwesomeGo
- func (ag *AwesomeGo) FetchAndRankRepositories(specificSection string, limit int) error
- func (ag *AwesomeGo) FetchAndRankRepositoriesContext(ctx context.Context, specificSection string, limit int) error
- func (ag *AwesomeGo) Repositories() map[string][]Repository
- func (ag *AwesomeGo) Sections() map[string]Section
- type ExportStats
- type GithubClient
- type GithubHtmlParserClient
- type IGithubClient
- type JSONExporter
- type JSONOutput
- type MockGithubClient
- type OutputMetadata
- type RateLimitInfo
- type RepoData
- type Repository
- type Section
- type SectionData
- type Snapshot
- type SnapshotRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnrichRepositoryTrends ¶
func EnrichRepositoryTrends(repos map[string][]Repository, snapshotDir string, capturedAt time.Time) error
EnrichRepositoryTrends adds exact 7-day and 30-day trend values from snapshots.
func MatchesSection ¶
MatchesSection reports whether an optional requested section exactly matches a section name.
func SaveSnapshot ¶
SaveSnapshot writes a deterministic gzip-compressed snapshot for capturedAt.
Types ¶
type AwesomeGo ¶
type AwesomeGo struct {
// contains filtered or unexported fields
}
AwesomeGo is the main struct for the awesome-go-ranking package.
func NewAwesomeGo ¶
func NewAwesomeGo(client IGithubClient, cfg *config.Config) *AwesomeGo
NewAwesomeGo creates a new AwesomeGo instance.
func (*AwesomeGo) FetchAndRankRepositories ¶
FetchAndRankRepositories fetches the repositories in the Awesome Go list
func (*AwesomeGo) FetchAndRankRepositoriesContext ¶
func (ag *AwesomeGo) FetchAndRankRepositoriesContext(ctx context.Context, specificSection string, limit int) error
FetchAndRankRepositoriesContext fetches repositories with cancellation support.
func (*AwesomeGo) Repositories ¶
func (ag *AwesomeGo) Repositories() map[string][]Repository
Repositories returns the repositories in the Awesome Go list.
type ExportStats ¶
type ExportStats struct {
TotalRepos int
TotalSections int
TopStarred []RepoData
RecentlyUpdated []RepoData
}
ExportStats represents statistics about the exported data
type GithubClient ¶
type GithubClient struct {
// contains filtered or unexported fields
}
GithubClient is a struct that represents a Github client.
func NewGithubClient ¶
func NewGithubClient(token string) *GithubClient
NewGithubClient creates a new GithubClient instance.
func (*GithubClient) FetchReadmeMarkdown ¶
func (ag *GithubClient) FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)
FetchReadmeMarkdown fetches the README.md file of a given repository.
func (*GithubClient) FetchRepository ¶
func (gc *GithubClient) FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)
FetchRepository fetches the repositories from the Github API
func (*GithubClient) GetRateLimitInfo ¶
func (gc *GithubClient) GetRateLimitInfo() RateLimitInfo
GetRateLimitInfo returns the current rate limit information
type GithubHtmlParserClient ¶
type GithubHtmlParserClient struct {
}
GithubHtmlParserClient is a struct that represents a Github client.
func NewGithubHtmlParserClient ¶
func NewGithubHtmlParserClient() *GithubHtmlParserClient
NewGithubHtmlParserClient creates a new GithubHtmlParserClient instance.
func (*GithubHtmlParserClient) FetchReadmeMarkdown ¶
func (ghpc *GithubHtmlParserClient) FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)
FetchReadmeMarkdown fetches the README.md file of a given repository.
func (*GithubHtmlParserClient) FetchRepository ¶
func (ghpc *GithubHtmlParserClient) FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)
FetchRepository fetches the repositories from parsing the HTML page.
type IGithubClient ¶
type IGithubClient interface {
// FetchReadmeMarkdown fetches the README.md file of a given repository.
FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)
// FetchRepository fetches the repositories from the Github API
FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)
// GetRateLimitInfo returns the current rate limit information
GetRateLimitInfo() RateLimitInfo
}
IGithubClient is an interface for the Github API
type JSONExporter ¶
type JSONExporter struct {
// contains filtered or unexported fields
}
JSONExporter handles exporting repository data to JSON
func NewJSONExporter ¶
func NewJSONExporter(repos map[string][]Repository, sections map[string]Section) *JSONExporter
NewJSONExporter creates a new JSONExporter
func (*JSONExporter) Export ¶
func (je *JSONExporter) Export(outputPath, sourceOwner, sourceRepo string) (err error)
Export exports the data to a JSON file
func (*JSONExporter) GetStats ¶
func (je *JSONExporter) GetStats(topN int) ExportStats
GetStats returns statistics about the repositories
type JSONOutput ¶
type JSONOutput struct {
UpdatedAt time.Time `json:"updatedAt"`
TotalRepos int `json:"totalRepos"`
TotalSections int `json:"totalSections"`
Sections []SectionData `json:"sections"`
Metadata OutputMetadata `json:"metadata"`
}
JSONOutput represents the complete JSON output structure
type MockGithubClient ¶
type MockGithubClient struct {
// contains filtered or unexported fields
}
MockGithubClient is a mock Github client
func NewMockGithubClient ¶
func NewMockGithubClient(result *Repository, readme string) *MockGithubClient
NewMockGithubClient creates a new MockGithubClient instance
func (*MockGithubClient) FetchReadmeMarkdown ¶
func (gc *MockGithubClient) FetchReadmeMarkdown(ctx context.Context, owner, repo string) (string, error)
FetchReadmeMarkdown fetches the README.md file of a given repository.
func (*MockGithubClient) FetchRepository ¶
func (gc *MockGithubClient) FetchRepository(ctx context.Context, owner, repo string) (*Repository, error)
FetchRepository fetches the repositories from the Github API
func (*MockGithubClient) GetRateLimitInfo ¶
func (gc *MockGithubClient) GetRateLimitInfo() RateLimitInfo
GetRateLimitInfo returns mock rate limit information
type OutputMetadata ¶
type OutputMetadata struct {
SourceOwner string `json:"sourceOwner"`
SourceRepo string `json:"sourceRepo"`
SourceURL string `json:"sourceUrl"`
GeneratedBy string `json:"generatedBy"`
Version string `json:"version"`
}
OutputMetadata contains metadata about the export
type RateLimitInfo ¶
type RateLimitInfo struct {
Remaining int
Limit int
ResetTime time.Time
// contains filtered or unexported fields
}
RateLimitInfo holds GitHub API rate limit information
type RepoData ¶
type RepoData struct {
Name string `json:"name"`
URL string `json:"url"`
Stars int `json:"stars"`
Forks int `json:"forks"`
LastUpdated time.Time `json:"lastUpdated"`
Description string `json:"description"`
StarsDelta7d *int `json:"starsDelta7d"`
StarsDelta30d *int `json:"starsDelta30d"`
Archived bool `json:"archived"`
IsNew bool `json:"isNew"`
}
RepoData represents repository data for JSON export
type Repository ¶
type Repository struct {
Name string
URL string
Stars int
Forks int
LastUpdated time.Time
Description string
Archived bool
StarsDelta7d *int
StarsDelta30d *int
StarsGrowth7d *float64
StarsGrowth30d *float64
IsNew bool
}
Repository is a struct that represents a repository.
type SectionData ¶
type SectionData struct {
Name string `json:"name"`
Description string `json:"description"`
RepoCount int `json:"repoCount"`
Repos []RepoData `json:"repos"`
}
SectionData represents a section with its repositories
type Snapshot ¶
type Snapshot struct {
Version int `json:"version"`
CapturedAt time.Time `json:"captured_at"`
Repositories []SnapshotRepository `json:"repositories"`
}
Snapshot is a point-in-time copy of repository ranking inputs.
type SnapshotRepository ¶
type SnapshotRepository struct {
FullName string `json:"full_name"`
Section string `json:"section"`
Stars int `json:"stars"`
Forks int `json:"forks"`
LastUpdated time.Time `json:"last_updated"`
Archived bool `json:"archived"`
}
SnapshotRepository is the stable, versioned repository snapshot schema.