Documentation ¶
Index ¶
- func CreateRepository(repoName string) (string, error)
- func CreateSubscriptions(userID, repoID string, labels Labels) error
- func CreateUser(username, email string) (string, error)
- func DeleteRepositoriesWithNoLabels() error
- func GetRepositoryIDByName(repoName string) (string, error)
- func GetUserIDByUsername(username string) (string, error)
- func RemoveSubscriptions(userID, repoID string, labels Labels) error
- func UpdateLastEventAtByRepoID(repoID, lastEventAt string) error
- func UpdateSubscriptions(userID, repoID string, labels Labels) error
- type Label
- type Labels
- type Repository
- type Subscription
- type User
- type UserIDLabel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateRepository ¶
CreateRepository creates a new repository in the database
func CreateSubscriptions ¶
CreateSubscriptions creates a new entry in the database with given `userID`, `repoID` and `labels`
func CreateUser ¶
CreateUser creates a new `User` in the database and returns the `userID` of the newly created `User`
func DeleteRepositoriesWithNoLabels ¶
func DeleteRepositoriesWithNoLabels() error
DeleteRepositoriesWithNoLabels deletes repositories which have no subscribed `labels`
func GetRepositoryIDByName ¶
GetRepositoryIDByName gets `repoID` for the given `repoName`
func GetUserIDByUsername ¶
GetUserIDByUsername gets `userID` for the given `username`
func RemoveSubscriptions ¶
RemoveSubscriptions removes all the given `labels` for the given `userID` and `repoID`
func UpdateLastEventAtByRepoID ¶
UpdateLastEventAtByRepoID updates `lastEventAt` time for the given `repoID`
func UpdateSubscriptions ¶
UpdateSubscriptions updates an existing subscription by adding the new `labels` for the given `userID` and `repoID`
Types ¶
type Label ¶
type Label struct { Name string `json:"name" db:"label_name"` Color string `json:"color" db:"label_color"` }
Label struct to store label information from database
type Labels ¶
type Labels []Label
Labels is of type `[]Label`
func GetSubscribedLabelsByUserIDAndRepoID ¶
GetSubscribedLabelsByUserIDAndRepoID gets all the subscribed `labels` for the given `userID` and `repoID`
type Repository ¶
type Repository struct { RepoID uuid.UUID `json:"repoID" db:"repo_id"` RepoName string `json:"repoName" db:"repo_name"` LastEventAt time.Time `json:"lastEventAt" db:"last_event_at"` }
Repository struct to store repository information from database
func GetAllRepositories ¶
func GetAllRepositories() ([]Repository, error)
GetAllRepositories gets all repositories from the database
type Subscription ¶
type Subscription struct { RepoName string `json:"repoName" db:"repo_name"` Labels Labels `json:"labels" db:"labels"` }
Subscription struct to store subscription info for a single repository
func GetSubscriptionsByUserID ¶
func GetSubscriptionsByUserID(userID string) ([]Subscription, error)
GetSubscriptionsByUserID gets all subscribed `labels` and the `userID` of the user who has subscribed for that particular for the give `repoID`
type User ¶
type User struct { UserID uuid.UUID `json:"userID" db:"user_id"` Username string `json:"username" db:"username"` Email string `json:"email" db:"email"` }
User struct to store user information from database
type UserIDLabel ¶
UserIDLabel struct stores userID-label pair
func GetSubscriptionsByRepoID ¶
func GetSubscriptionsByRepoID(repoID string) ([]UserIDLabel, error)
GetSubscriptionsByRepoID gets all subscriptions for the given `repoID`