Documentation
¶
Index ¶
- func Create(projects Store, client *http.Client, apiHost, webhookSecret string) http.Handler
- func Delete(projects Store) http.Handler
- func GetAccessToken(projects Store) http.Handler
- func GetAll(projects Store) http.Handler
- type Postgres
- func (store *Postgres) Create(accountID, creatorID int64, ...) (projectID int64, err error)
- func (store *Postgres) Delete(accountID, projectID int64) error
- func (store *Postgres) GetAccessToken(accountID, projectID int64) (accessToken string, err error)
- func (store *Postgres) GetAll(accountID int64) ([]Project, error)
- func (store *Postgres) GetAllWatchingRepo(repo string) ([]Project, error)
- func (store *Postgres) ReferencesForRepo(repository string) (regexPerProject map[int64]string, err error)
- type Project
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create creates a project (and accompanying webhook if one is not already registered for the repo).
func GetAccessToken ¶
GetAccessToken returns the access token (e.g. GitHub) for the project.
Types ¶
type Postgres ¶
Postgres is a postgres projects `Store` implementation.
func (*Postgres) Create ¶
func (store *Postgres) Create(accountID, creatorID int64, title, description, repo, refs, vcsAccessToken string) (projectID int64, err error)
Create creates a new project.
func (*Postgres) GetAccessToken ¶
GetAccessToken returns the vcs (e.g. GitHub) access token for the given account and project.
func (*Postgres) GetAllWatchingRepo ¶
GetAllWatchingRepo returns all projects watching for chanegs to the repo provided.
func (*Postgres) ReferencesForRepo ¶
func (store *Postgres) ReferencesForRepo(repository string) (regexPerProject map[int64]string, err error)
ReferencesForRepo returns the allowed references regex (branches and tags a project should build) for a repository. The returnd result is a map of project ids to allowed regex.
type Project ¶
type Project struct {
ID int64 `json:"projectID"`
AccountID int64 `json:"accountID"`
CreatorID int64 `json:"creatorID"`
Creator string `json:"creator"`
Title string `json:"title"`
Description string `json:"description"`
Repo string `json:"repo"`
Branch string `json:"branch"`
Created string `json:"created"`
Updated string `json:"updated"`
}
The Project domain model.
type Store ¶
type Store interface {
// Delete deletes a project.
Delete(accountID, projectID int64) error
// GetAccessToken returns the vcs (e.g. GitHub) access token for the given account and project.
GetAccessToken(accountID, projectID int64) (string, error)
// GetAll returns all projects under the account ID provided.
GetAll(accountID int64) ([]Project, error)
// GetAllWatchingRepo returns all projects watching for changes to the repo provided.
GetAllWatchingRepo(repo string) ([]Project, error)
// ReferencesForRepo returns the allowed references regex (branches and tags a project should build) for a repository.
// The returnd result is a map of project ids to allowed regex.
ReferencesForRepo(repository string) (regexPerProject map[int64]string, err error)
// Create creates a new project.
Create(accountID, creatorID int64, title, description, repoURL, branch, githubAccessToken string) (projectID int64, err error)
}
Store abstracts communication with the service's persistance mechanism(s).