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 Owner
- type RankedTrendingDevelopers
- type RankedTrendingRepository
- 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"` Trendings []Trending `json:"trendings"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type DeveloperRepo ¶
type DeveloperRepo struct {
// contains filtered or unexported fields
}
func NewDeveloperRepo ¶
func NewDeveloperRepo(db database.DB, qb *dbutils.QueryBuilder) *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"` Tags []Tag `json:"tags"` Trendings []Trending `json:"trendings"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
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, qb *dbutils.QueryBuilder) *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 RankedTrendingDevelopers ¶
type RankedTrendingDevelopers = map[int]TrendingDeveloper
type RankedTrendingRepository ¶
type RankedTrendingRepository = map[int]TrendingRepository
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 string `json:"trend_date"` Rank int `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.