Documentation ¶
Index ¶
- type Condition
- type DB
- type Dates
- type Filter
- type SQLDB
- func (db *SQLDB) Condition(ctx context.Context, conditionID int) (*Condition, error)
- func (db *SQLDB) ConditionCreate(ctx context.Context, condition *Condition) (int, error)
- func (db *SQLDB) ConditionDelete(ctx context.Context, userID, conditionID int) error
- func (db *SQLDB) Filter(ctx context.Context, filterID int) (*Filter, error)
- func (db *SQLDB) FilterUpdate(ctx context.Context, filter *Filter) error
- func (db *SQLDB) GitHubLogin(ctx context.Context, email string, githubID int, githubLogin string, ...) (int, error)
- func (db *SQLDB) SetUsersPollResult(ctx context.Context, userID int, lastCreatedAt, nextPoll time.Time) error
- func (db *SQLDB) User(ctx context.Context, userID int) (*User, error)
- func (db *SQLDB) UserUpdate(ctx context.Context, user *User) error
- func (db *SQLDB) Users(_ context.Context) ([]User, error)
- func (db *SQLDB) UsersFilters(ctx context.Context, userID int) ([]Filter, error)
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Condition ¶
type Condition struct { Dates ID int `db:"id"` FilterID int `db:"filter_id"` Negate bool `db:"negate"` Type string `db:"type"` PayloadAction string `db:"payload_action"` PayloadIssueLabel string `db:"payload_issue_label"` PayloadIssueMilestoneTitle string `db:"payload_issue_milestone_title"` PayloadIssueTitleRegexp string `db:"payload_issue_title_regexp"` PayloadIssueBodyRegexp string `db:"payload_issue_body_regexp"` ComparePublic bool `db:"compare_public"` Public bool `db:"public"` OrganizationID int `db:"organization_id"` RepositoryID int `db:"repository_id"` }
Condition represents a single condition from the conditions table.
func (Condition) GHCondition ¶
type DB ¶
type DB interface { // Users returns a list of active users that need are scheduled to be polled. Users(context.Context) ([]User, error) // User returns a single user from the database, returns nil if no user was found. User(ctx context.Context, userID int) (*User, error) // UserUpdate updates a user in the database. UserUpdate(context.Context, *User) error // UsersFilters returns all filters for a User ID. UsersFilters(ctx context.Context, userID int) ([]Filter, error) // Filter returns a single filter from the database, returns nil if no filter found. Filter(ctx context.Context, filterID int) (*Filter, error) // FilterUpdate updates a filter in the database. FilterUpdate(context.Context, *Filter) error // Condition returns a single condition from the database, returns nil if no condition found. Condition(ctx context.Context, conditionID int) (*Condition, error) // ConditionDelete deletes a userID's condition from the database. ConditionDelete(ctsx context.Context, userID, conditionID int) error // ConditionCreate inserts a condition into the database. ConditionCreate(context.Context, *Condition) (conditionID int, err error) // SetUsersNextUpdate SetUsersPollResult(ctx context.Context, userID int, lastCreatedAt time.Time, nextUpdate time.Time) error // GitHubLogin logs a user in via GitHub, if a user already exists with the same // githubID, the user's accessToken is updated, else a new user is created. GitHubLogin(ctx context.Context, email string, githubID int, githubLogin string, token *oauth2.Token) (userID int, err error) }
DB represents a database.
type Filter ¶
type Filter struct { Dates ID int `db:"id"` UserID int `db:"user_id"` // If discard is true, the filter matching causes an event to be discarded // instead of accepted. OnMatchDiscard bool `db:"on_match_discard"` Conditions []Condition }
Filter represents a single filter from the filters table.
type SQLDB ¶
type SQLDB struct {
// contains filtered or unexported fields
}
func (*SQLDB) ConditionCreate ¶
ConditionCreate implements the DB interface.
func (*SQLDB) ConditionDelete ¶
ConditionDelete implements the DB interface.
func (*SQLDB) FilterUpdate ¶
FilterUpdate implements the DB interface.
func (*SQLDB) GitHubLogin ¶
func (db *SQLDB) GitHubLogin(ctx context.Context, email string, githubID int, githubLogin string, token *oauth2.Token) (int, error)
GitHubLogin implements the DB interface.
func (*SQLDB) SetUsersPollResult ¶
func (db *SQLDB) SetUsersPollResult(ctx context.Context, userID int, lastCreatedAt, nextPoll time.Time) error
SetUsersPollResult implements the DB interface.
func (*SQLDB) UserUpdate ¶
UserUpdate implements the DB interface.
type User ¶
type User struct { Dates ID int `db:"id"` Email string `db:"email"` GitHubID int `db:"github_id"` GitHubLogin string `db:"github_login"` GitHubTokenRaw []byte `db:"github_token"` GitHubToken *oauth2.Token FilterDefaultDiscard bool `db:"filter_default_discard"` EventLastCreatedAt time.Time // the latest created at event for the customer EventNextPoll time.Time // time when the next update should occur }
Click to show internal directories.
Click to hide internal directories.