Documentation
¶
Index ¶
- type DailyStat
- type Developer
- type DeveloperRepo
- func (dr *DeveloperRepo) FindAll(ctx context.Context, opts ...any) ([]Developer, error)
- func (dr *DeveloperRepo) FindById(ctx context.Context, id int) (Developer, error)
- func (dr *DeveloperRepo) FindDevelopersByUsernames(ctx context.Context, names []string) ([]Developer, error)
- func (dr *DeveloperRepo) FindTrendingDevelopers(ctx context.Context, opts ...any) ([]TrendingDeveloperResponse, error)
- func (dr *DeveloperRepo) Save(ctx context.Context, developer Developer) (int64, error)
- func (dr *DeveloperRepo) Update(ctx context.Context, developer Developer) error
- type GhRepository
- type GhRepositoryRepo
- func (gr *GhRepositoryRepo) FindAll(ctx context.Context, opts ...any) ([]GhRepository, error)
- func (gr *GhRepositoryRepo) FindAllWithTags(ctx context.Context, filter string) ([]*GhRepository, error)
- func (gr *GhRepositoryRepo) FindById(ctx context.Context, id int) (GhRepository, error)
- func (gr *GhRepositoryRepo) FindByName(ctx context.Context, name string) (GhRepository, error)
- func (gr *GhRepositoryRepo) FindRepositoriesByNames(ctx context.Context, names []string) ([]GhRepository, error)
- func (gr *GhRepositoryRepo) FindTrendingRepositories(ctx context.Context, opts ...any) ([]TrendingRepositoryResponse, error)
- func (gr *GhRepositoryRepo) Save(ctx context.Context, ghRepo GhRepository) (int64, error)
- func (gr *GhRepositoryRepo) SaveTags(ctx context.Context, ghRepo GhRepository, tags []Tag) error
- func (gr *GhRepositoryRepo) Update(ctx context.Context, ghRepo GhRepository) error
- type License
- type ListEngagementParams
- type Owner
- type RankedTrendingDevelopers
- type RankedTrendingRepository
- type RepositoryMonthlyEngagement
- type RepositoryMonthlyInsight
- type RepositoryMonthlyInsightRepo
- func (rr *RepositoryMonthlyInsightRepo) CreateMonthlyInsightsIfNotExist(ctx context.Context, month, year int) (int64, error)
- func (rr *RepositoryMonthlyInsightRepo) FindByRepositoryId(ctx context.Context, repositoryId int) ([]RepositoryMonthlyInsight, error)
- func (rr *RepositoryMonthlyInsightRepo) FindIncompletedLastIngestedBefore(ctx context.Context, before time.Time, limit int) ([]RepositoryMonthlyInsightWithName, error)
- func (rr *RepositoryMonthlyInsightRepo) FindRepositoryMonthlyEngagements(ctx context.Context, params *ListEngagementParams) ([]RepositoryMonthlyEngagement, error)
- func (rr *RepositoryMonthlyInsightRepo) Update(ctx context.Context, data RepositoryMonthlyInsightWithName) error
- type RepositoryMonthlyInsightWithName
- type RepositoryWithActivities
- type StatsRepo
- type Tag
- type TagRepo
- type Trending
- type TrendingDeveloper
- type TrendingDeveloperRepo
- func (tdr *TrendingDeveloperRepo) FindRankedTrendingDevelopersByDate(ctx context.Context, date time.Time, language string) (RankedTrendingDevelopers, error)
- func (tdr *TrendingDeveloperRepo) FindUnlinkedDevelopers(ctx context.Context) ([]string, error)
- func (tdr *TrendingDeveloperRepo) LinkDeveloper(ctx context.Context, developer Developer) error
- func (tdr *TrendingDeveloperRepo) Save(ctx context.Context, trendingDeveloper TrendingDeveloper) error
- func (tdr *TrendingDeveloperRepo) Update(ctx context.Context, trendingDeveloper TrendingDeveloper) error
- type TrendingDeveloperResponse
- type TrendingRepository
- type TrendingRepositoryRepo
- func (tr *TrendingRepositoryRepo) FindRankedTrendingRepoByDate(ctx context.Context, date time.Time, language string) (RankedTrendingRepository, error)
- func (tr *TrendingRepositoryRepo) FindUnlinkedRepositories(ctx context.Context) ([]string, error)
- func (tr *TrendingRepositoryRepo) LinkRepository(ctx context.Context, repository GhRepository) error
- func (tr *TrendingRepositoryRepo) Save(ctx context.Context, trendingRepository TrendingRepository) error
- func (tr *TrendingRepositoryRepo) Update(ctx context.Context, trendingRepository TrendingRepository) error
- type TrendingRepositoryResponse
- type User
- type UserRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Developer ¶
type Developer struct {
Id int `json:"developer_id"` // primary key saved in DB.
GhId int `json:"id"` // id from github repository api response.
Username string `json:"login"` // github api use login as username.
AvatarUrl string `json:"avatar_url"`
Name dbutils.NullString `json:"name"`
Company dbutils.NullString `json:"company"`
Blog dbutils.NullString `json:"blog"`
Location dbutils.NullString `json:"location"`
Email dbutils.NullString `json:"email"`
Bio dbutils.NullString `json:"bio"`
TwitterUsername dbutils.NullString `json:"twitter_username"`
PublicRepos int `json:"public_repos"`
PublicGists int `json:"public_gists"`
Followers int `json:"followers"`
Following int `json:"following"`
Skipped bool `json:"skipped"`
Trendings []Trending `json:"trendings"`
CreatedAt time.Time `json:"created_at"` // It is the datetime the developer was created on GitHub.
UpdatedAt time.Time `json:"updated_at"` // It is the datetime we update the DB record, not when developer info updated on GitHub
}
type DeveloperRepo ¶
type DeveloperRepo struct {
// contains filtered or unexported fields
}
func NewDeveloperRepo ¶
func NewDeveloperRepo(db database.DB) *DeveloperRepo
func (*DeveloperRepo) FindDevelopersByUsernames ¶
func (*DeveloperRepo) FindTrendingDevelopers ¶ added in v0.5.0
func (dr *DeveloperRepo) FindTrendingDevelopers(ctx context.Context, opts ...any) ([]TrendingDeveloperResponse, error)
type GhRepository ¶
type GhRepository struct {
Id int `json:"repository_id"` // primary key saved in DB.
GhrId int `json:"id"` // id from github repository api response.
FullName string `json:"full_name"`
Owner Owner `json:"owner"`
Forks int `json:"forks"`
Stars int `json:"watchers"`
Language string `json:"language"`
Description dbutils.NullString `json:"description"`
DefaultBranch dbutils.NullString `json:"default_branch"`
Homepage dbutils.NullString `json:"homepage"`
Skipped bool `json:"skipped"`
NumberOfContributors dbutils.NullInt64 `json:"number_of_contributors"`
LastCommitAt dbutils.NullTime `json:"last_commit_at"`
LastUserCommitAt dbutils.NullTime `json:"last_user_commit_at"`
License License `json:"license"`
LicenseKey string `json:"license_key"`
LicenseName string `json:"license_name"`
Tags []Tag `json:"tags"`
Trendings []Trending `json:"trendings"`
CreatedAt time.Time `json:"created_at"` // It is the datetime the repository was created on GitHub.
UpdatedAt time.Time `json:"updated_at"` // It is the datetime we update the DB record, not when repository info updated on GitHub
}
func (GhRepository) GetDescription ¶
func (gr GhRepository) GetDescription() string
type GhRepositoryRepo ¶
type GhRepositoryRepo struct {
// contains filtered or unexported fields
}
func NewGhRepositoryRepo ¶
func NewGhRepositoryRepo(db database.DB) *GhRepositoryRepo
func (*GhRepositoryRepo) FindAll ¶
func (gr *GhRepositoryRepo) FindAll(ctx context.Context, opts ...any) ([]GhRepository, error)
func (*GhRepositoryRepo) FindAllWithTags ¶
func (gr *GhRepositoryRepo) FindAllWithTags(ctx context.Context, filter string) ([]*GhRepository, error)
func (*GhRepositoryRepo) FindById ¶
func (gr *GhRepositoryRepo) FindById(ctx context.Context, id int) (GhRepository, error)
func (*GhRepositoryRepo) FindByName ¶
func (gr *GhRepositoryRepo) FindByName(ctx context.Context, name string) (GhRepository, error)
func (*GhRepositoryRepo) FindRepositoriesByNames ¶
func (gr *GhRepositoryRepo) FindRepositoriesByNames(ctx context.Context, names []string) ([]GhRepository, error)
func (*GhRepositoryRepo) FindTrendingRepositories ¶
func (gr *GhRepositoryRepo) FindTrendingRepositories(ctx context.Context, opts ...any) ([]TrendingRepositoryResponse, error)
func (*GhRepositoryRepo) Save ¶
func (gr *GhRepositoryRepo) Save(ctx context.Context, ghRepo GhRepository) (int64, error)
func (*GhRepositoryRepo) SaveTags ¶
func (gr *GhRepositoryRepo) SaveTags(ctx context.Context, ghRepo GhRepository, tags []Tag) error
func (*GhRepositoryRepo) Update ¶
func (gr *GhRepositoryRepo) Update(ctx context.Context, ghRepo GhRepository) error
type License ¶ added in v0.13.0
type License struct {
Key dbutils.NullString `json:"key"`
Name dbutils.NullString `json:"name"`
SpdxId string `json:"spdx_id"`
Url string `json:"url"`
NodeId string `json:"node_id"`
}
type ListEngagementParams ¶ added in v0.11.0
type ListEngagementParams struct {
Metric string
Year int
Month int
Language string
Limit int
CreatedAfter time.Time
}
func NewListEngagementParams ¶ added in v0.11.0
func NewListEngagementParams(metricStr, yearStr, monthStr, languageStr, limitStr, createdAfterStr string) (*ListEngagementParams, error)
func (ListEngagementParams) ValidateMetric ¶ added in v0.11.0
func (params ListEngagementParams) ValidateMetric() error
type RankedTrendingDevelopers ¶
type RankedTrendingDevelopers = map[int]TrendingDeveloper
type RankedTrendingRepository ¶
type RankedTrendingRepository = map[int]TrendingRepository
type RepositoryMonthlyEngagement ¶ added in v0.11.0
type RepositoryMonthlyEngagement struct {
Id int `json:"id"`
Year int `json:"year"`
Month int `json:"month"`
Stars dbutils.NullInt64 `json:"stars"`
Forks dbutils.NullInt64 `json:"forks"`
MergedPrs dbutils.NullInt64 `json:"merged_prs"`
Issues dbutils.NullInt64 `json:"issues"`
ClosedIssues dbutils.NullInt64 `json:"closed_issues"`
CompletedAt dbutils.NullTime `json:"completed_at"`
LastIngestedAt dbutils.NullTime `json:"last_ingested_at"`
RepositoryId int `json:"repository_id"`
RepositoryName string `json:"repository_name"`
RepositoryStars int `json:"repository_stars"`
RepositoryForks int `json:"repository_forks"`
RepositoryLanguage dbutils.NullString `json:"repository_language"`
RepositoryCreatedAt dbutils.NullTime `json:"repository_created_at"`
}
type RepositoryMonthlyInsight ¶ added in v0.10.0
type RepositoryMonthlyInsight struct {
Id int `json:"id"`
Year int `json:"year"`
Month int `json:"month"`
Stars dbutils.NullInt64 `json:"stars"`
Forks dbutils.NullInt64 `json:"forks"`
MergedPrs dbutils.NullInt64 `json:"merged_prs"`
Issues dbutils.NullInt64 `json:"issues"`
ClosedIssues dbutils.NullInt64 `json:"closed_issues"`
CompletedAt dbutils.NullTime `json:"completed_at"`
LastIngestedAt dbutils.NullTime `json:"last_ingested_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
RepositoryId int `json:"repository_id"`
}
type RepositoryMonthlyInsightRepo ¶ added in v0.10.0
type RepositoryMonthlyInsightRepo struct {
// contains filtered or unexported fields
}
func NewRepositoryMonthlyInsightRepo ¶ added in v0.10.0
func NewRepositoryMonthlyInsightRepo(db database.DB) *RepositoryMonthlyInsightRepo
func (*RepositoryMonthlyInsightRepo) CreateMonthlyInsightsIfNotExist ¶ added in v0.10.0
func (*RepositoryMonthlyInsightRepo) FindByRepositoryId ¶ added in v0.12.0
func (rr *RepositoryMonthlyInsightRepo) FindByRepositoryId(ctx context.Context, repositoryId int) ([]RepositoryMonthlyInsight, error)
func (*RepositoryMonthlyInsightRepo) FindIncompletedLastIngestedBefore ¶ added in v0.10.0
func (rr *RepositoryMonthlyInsightRepo) FindIncompletedLastIngestedBefore(ctx context.Context, before time.Time, limit int) ([]RepositoryMonthlyInsightWithName, error)
func (*RepositoryMonthlyInsightRepo) FindRepositoryMonthlyEngagements ¶ added in v0.11.0
func (rr *RepositoryMonthlyInsightRepo) FindRepositoryMonthlyEngagements(ctx context.Context, params *ListEngagementParams) ([]RepositoryMonthlyEngagement, error)
func (*RepositoryMonthlyInsightRepo) Update ¶ added in v0.10.0
func (rr *RepositoryMonthlyInsightRepo) Update(ctx context.Context, data RepositoryMonthlyInsightWithName) error
type RepositoryMonthlyInsightWithName ¶ added in v0.10.0
type RepositoryMonthlyInsightWithName struct {
RepositoryMonthlyInsight
RepositoryName string
}
type RepositoryWithActivities ¶ added in v0.12.0
type RepositoryWithActivities struct {
GhRepository
MonthlyActivities []RepositoryMonthlyInsight `json:"monthly_activities"`
}
type StatsRepo ¶
type StatsRepo struct {
// contains filtered or unexported fields
}
func NewStatsRepo ¶
type TagRepo ¶
type TagRepo struct {
// contains filtered or unexported fields
}
func NewTagRepo ¶
func (*TagRepo) FindByName ¶
type Trending ¶
type Trending struct {
TrendingLanguage dbutils.NullString `json:"trending_language"`
TrendDate dbutils.NullString `json:"trend_date"`
Rank dbutils.NullInt64 `json:"rank"`
}
type TrendingDeveloper ¶
type TrendingDeveloperRepo ¶
type TrendingDeveloperRepo struct {
// contains filtered or unexported fields
}
func NewTrendingDeveloperRepo ¶
func NewTrendingDeveloperRepo(db database.DB) *TrendingDeveloperRepo
func (*TrendingDeveloperRepo) FindRankedTrendingDevelopersByDate ¶
func (tdr *TrendingDeveloperRepo) FindRankedTrendingDevelopersByDate(ctx context.Context, date time.Time, language string) (RankedTrendingDevelopers, error)
func (*TrendingDeveloperRepo) FindUnlinkedDevelopers ¶
func (tdr *TrendingDeveloperRepo) FindUnlinkedDevelopers(ctx context.Context) ([]string, error)
func (*TrendingDeveloperRepo) LinkDeveloper ¶
func (tdr *TrendingDeveloperRepo) LinkDeveloper(ctx context.Context, developer Developer) error
func (*TrendingDeveloperRepo) Save ¶
func (tdr *TrendingDeveloperRepo) Save(ctx context.Context, trendingDeveloper TrendingDeveloper) error
func (*TrendingDeveloperRepo) Update ¶
func (tdr *TrendingDeveloperRepo) Update(ctx context.Context, trendingDeveloper TrendingDeveloper) error
type TrendingDeveloperResponse ¶ added in v0.5.0
type TrendingRepository ¶
type TrendingRepositoryRepo ¶
type TrendingRepositoryRepo struct {
// contains filtered or unexported fields
}
func NewTrendingRepositoryRepo ¶
func NewTrendingRepositoryRepo(db database.DB) *TrendingRepositoryRepo
func (*TrendingRepositoryRepo) FindRankedTrendingRepoByDate ¶
func (tr *TrendingRepositoryRepo) FindRankedTrendingRepoByDate(ctx context.Context, date time.Time, language string) (RankedTrendingRepository, error)
func (*TrendingRepositoryRepo) FindUnlinkedRepositories ¶
func (tr *TrendingRepositoryRepo) FindUnlinkedRepositories(ctx context.Context) ([]string, error)
Get all repositories' full name when there is no repository_id set in the table.
func (*TrendingRepositoryRepo) LinkRepository ¶
func (tr *TrendingRepositoryRepo) LinkRepository(ctx context.Context, repository GhRepository) error
Save the relation between trending repositories and repositories.
func (*TrendingRepositoryRepo) Save ¶
func (tr *TrendingRepositoryRepo) Save(ctx context.Context, trendingRepository TrendingRepository) error
func (*TrendingRepositoryRepo) Update ¶
func (tr *TrendingRepositoryRepo) Update(ctx context.Context, trendingRepository TrendingRepository) error
Update the trending repository as well as unlink the relationship between tranding repository and repository as the repository might be changed in the same rank. Then we leave the linking service to re-link the repository properly.
type TrendingRepositoryResponse ¶
type TrendingRepositoryResponse struct {
GhRepository
BestRanking int `json:"best_ranking"` // non db column field
FeaturedCount int `json:"featured_count"` // non db column field
}
type User ¶
type User struct {
Id int
Username string
Password string
Role string
CreatedAt time.Time
UpdatedAt time.Time
}
func (*User) IsPasswordValid ¶
func (*User) SetPassword ¶
type UserRepo ¶
type UserRepo struct {
// contains filtered or unexported fields
}
func NewUserRepo ¶
func (*UserRepo) FindByName ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.