database

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close added in v0.2.1

func Close()

Close database connection.

func DeleteBuild

func DeleteBuild(id int64) error

Deletes an existing Build.

func DeleteCommit

func DeleteCommit(id int64) error

Deletes an existing Commit.

func DeleteMember

func DeleteMember(user, team int64) error

Deletes an existing Member.

func DeleteRepo

func DeleteRepo(id int64) error

Deletes an existing Repository. TODO need to delete builds too.

func DeleteTeam

func DeleteTeam(id int64) error

Deletes an existing Team account.

func DeleteUser

func DeleteUser(id int64) error

Deletes an existing User account.

func FailUnfinishedBuilds added in v0.2.1

func FailUnfinishedBuilds() error

FailUnfinishedBuilds sets status=Failure to all builds in the Pending and Started states

func FailUnfinishedCommits added in v0.2.1

func FailUnfinishedCommits() error

func GetBranch

func GetBranch(repo int64, branch string) (*Commit, error)

Returns the most recent Commit for the given branch.

func GetBuild

func GetBuild(id int64) (*Build, error)

Returns the Build with the given ID.

func GetBuildSlug

func GetBuildSlug(slug string, commit int64) (*Build, error)

Returns the Build with the given slug.

func GetCommit

func GetCommit(id int64) (*Commit, error)

Returns the Commit with the given ID.

func GetCommitBranchHash added in v0.2.1

func GetCommitBranchHash(branch string, hash string, repo int64) (*Commit, error)

Returns the Commit on the given branch with the given hash.

func GetCommitHash

func GetCommitHash(hash string, repo int64) (*Commit, error)

Returns the Commit with the given hash.

func GetMember

func GetMember(user, team int64) (*Member, error)

Returns the Member with the given user and team IDs.

func GetPassEmail

func GetPassEmail(email string) ([]byte, error)

Returns the User Password Hash for the given email address.

func GetRepo

func GetRepo(id int64) (*Repo, error)

Returns the Repo with the given ID.

func GetRepoSlug

func GetRepoSlug(slug string) (*Repo, error)

Returns the Repo with the given slug.

func GetSettings

func GetSettings() (*Settings, error)

Returns the system Settings.

func GetTeam

func GetTeam(id int64) (*Team, error)

Returns the Team with the given ID.

func GetTeamSlug

func GetTeamSlug(slug string) (*Team, error)

Returns the Team with the given slug.

func GetUser

func GetUser(id int64) (*User, error)

Returns the User with the given ID.

func GetUserEmail

func GetUserEmail(email string) (*User, error)

Returns the User with the given email address.

func Init added in v0.2.1

func Init(name, datasource string) error

Init connects to database and performs migration if necessary.

Database driver name and data source information is provided by user from within command line, and error checking is deferred to sql.Open.

Init will just bail out and returns error if driver name is not listed, no fallback nor default driver sets here.

func IsMember

func IsMember(user, team int64) (bool, error)

Returns true if the user is a member of the team

func IsMemberAdmin

func IsMemberAdmin(user, team int64) (bool, error)

Returns true is the user is an admin member of the team.

func IsRepoAdmin added in v0.2.1

func IsRepoAdmin(user *User, repo *Repo) (bool, error)

Checks whether a user is admin of a repo Returns true if user owns repo or is on team that owns repo Returns true if the user is an admin member of the team.

func ListBranches

func ListBranches(repo int64) ([]*Commit, error)

Returns a list of the most recent commits for each branch.

func ListBuilds

func ListBuilds(id int64) ([]*Build, error)

Returns a list of all Builds associated with the specified Commit ID and branch.

func ListCommits

func ListCommits(repo int64, branch string) ([]*Commit, error)

Returns a list of all Commits associated with the specified Repo ID.

func ListCommitsTeam

func ListCommitsTeam(team int64) ([]*RepoCommit, error)

Returns a list of recent Commits associated with the specified Team ID

func ListCommitsUser

func ListCommitsUser(user int64) ([]*RepoCommit, error)

Returns a list of recent Commits associated with the specified User ID

func ListMembers

func ListMembers(team int64) ([]*Member, error)

Returns a list of all Team members.

func ListRepos

func ListRepos(id int64) ([]*Repo, error)

Returns a list of all Repos associated with the specified User ID.

func ListReposTeam

func ListReposTeam(id int64) ([]*Repo, error)

Returns a list of all Repos associated with the specified Team ID.

func ListTeams

func ListTeams(id int64) ([]*Team, error)

Returns a list of all Teams associated with the specified User ID.

func ListUsers

func ListUsers() ([]*User, error)

Returns a list of all Users.

func ListUsersRange

func ListUsersRange(limit, offset int) ([]*User, error)

Returns a list of Users within the specified range (for pagination purposes).

func SaveBuild

func SaveBuild(build *Build) error

Creates a new Build.

func SaveCommit

func SaveCommit(commit *Commit) error

Creates a new Commit.

func SaveMember

func SaveMember(user, team int64, role string) error

Creates a new Member.

func SaveRepo

func SaveRepo(repo *Repo) error

Creates a new Repository.

func SaveSettings

func SaveSettings(settings *Settings) error

Saves the system Settings.

func SaveTeam

func SaveTeam(team *Team) error

Saves a Team.

func SaveUser

func SaveUser(user *User) error

Saves the User account.

func SettingsMust

func SettingsMust() *Settings

Returns the system Settings. This is expected always pass, and will panic on failure.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL