datastore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DelCommit

func DelCommit(c context.Context, commit *model.Commit) error

DelCommit removes the commit from the datastore.

func DelPerm

func DelPerm(c context.Context, perm *model.Perm) error

DelPerm removes permission from the datastore.

func DelRepo

func DelRepo(c context.Context, repo *model.Repo) error

DelRepo removes the repo from the datastore.

func DelUser

func DelUser(c context.Context, user *model.User) error

DelUser removes the user from the datastore.

func GetBuildNumber

func GetBuildNumber(c context.Context, commit *model.Commit) (int64, error)

GetBuildNumber retrieves the monotonically increaing build number from the commit's repo

func GetCommit

func GetCommit(c context.Context, id int64) (*model.Commit, error)

GetCommit retrieves a commit from the datastore for the given ID.

func GetCommitLast

func GetCommitLast(c context.Context, repo *model.Repo, branch string) (*model.Commit, error)

GetCommitLast retrieves the latest commit from the datastore for the specified repository and branch.

func GetCommitList

func GetCommitList(c context.Context, repo *model.Repo, limit, offset int) ([]*model.Commit, error)

GetCommitList retrieves a list of latest commits from the datastore for the specified repository.

func GetCommitListActivity

func GetCommitListActivity(c context.Context, user *model.User, limit, offset int) ([]*model.CommitRepo, error)

GetCommitListActivity retrieves an ungrouped list of latest commits from the datastore accessible to the specified user.

func GetCommitListUser

func GetCommitListUser(c context.Context, user *model.User) ([]*model.CommitRepo, error)

GetCommitListUser retrieves a list of latest commits from the datastore accessible to the specified user.

func GetCommitPrior

func GetCommitPrior(c context.Context, commit *model.Commit) (*model.Commit, error)

GetCommitPrior retrieves the latest commit from the datastore for the specified repository and branch.

func GetCommitSha

func GetCommitSha(c context.Context, repo *model.Repo, branch, sha string) (*model.Commit, error)

GetCommitSha retrieves a commit from the datastore for the specified repo and sha

func GetPerm

func GetPerm(c context.Context, user *model.User, repo *model.Repo) (*model.Perm, error)

GetPerm retrieves the User's permission from the datastore for the given repository.

func GetRepo

func GetRepo(c context.Context, id int64) (*model.Repo, error)

GetRepo retrieves a specific repo from the datastore for the given ID.

func GetRepoList

func GetRepoList(c context.Context, user *model.User) ([]*model.Repo, error)

GetRepoList retrieves a list of all repos from the datastore accessible by the given user ID.

func GetRepoName

func GetRepoName(c context.Context, remote, owner, name string) (*model.Repo, error)

GetRepoName retrieves a repo from the datastore for the specified remote, owner and name.

func GetUser

func GetUser(c context.Context, id int64) (*model.User, error)

GetUser retrieves a specific user from the datastore for the given ID.

func GetUserList

func GetUserList(c context.Context) ([]*model.User, error)

GetUserList retrieves a list of all users from the datastore that are registered in the system.

func GetUserLogin

func GetUserLogin(c context.Context, remote, login string) (*model.User, error)

GetUserLogin retrieves a user from the datastore for the specified remote and login name.

func GetUserToken

func GetUserToken(c context.Context, token string) (*model.User, error)

GetUserToken retrieves a user from the datastore with the specified token.

func KillCommits

func KillCommits(c context.Context) error

KillCommits updates all pending or started commits in the datastore settings the status to killed.

func NewContext

func NewContext(parent context.Context, ds Datastore) context.Context

NewContext returns a Context whose Value method returns the application's data storage objects.

func PostCommit

func PostCommit(c context.Context, commit *model.Commit) error

PostCommit saves a commit in the datastore.

func PostPerm

func PostPerm(c context.Context, perm *model.Perm) error

PostPerm saves permission in the datastore.

func PostRepo

func PostRepo(c context.Context, repo *model.Repo) error

PostRepo saves a repo in the datastore.

func PostUser

func PostUser(c context.Context, user *model.User) error

PostUser saves a User in the datastore.

func PutCommit

func PutCommit(c context.Context, commit *model.Commit) error

PutCommit saves a commit in the datastore.

func PutPerm

func PutPerm(c context.Context, perm *model.Perm) error

PutPerm saves permission in the datastore.

func PutRepo

func PutRepo(c context.Context, repo *model.Repo) error

PutRepo saves a repo in the datastore.

func PutUser

func PutUser(c context.Context, user *model.User) error

PutUser saves a user in the datastore.

Types

type Commitstore

type Commitstore interface {
	// GetCommit retrieves a commit from the
	// datastore for the given ID.
	GetCommit(id int64) (*model.Commit, error)

	// GetCommitSha retrieves a commit from the
	// datastore for the specified repo and sha
	GetCommitSha(repo *model.Repo, branch, sha string) (*model.Commit, error)

	// GetCommitLast retrieves the latest commit
	// from the datastore for the specified repository
	// and branch.
	GetCommitLast(repo *model.Repo, branch string) (*model.Commit, error)

	// GetCommitList retrieves a list of latest commits
	// from the datastore for the specified repository.
	GetCommitList(repo *model.Repo, limit, offset int) ([]*model.Commit, error)

	// GetCommitListUser retrieves a list of latest commits
	// from the datastore accessible to the specified user.
	GetCommitListUser(user *model.User) ([]*model.CommitRepo, error)

	// GetCommitListActivity retrieves an ungrouped list of latest commits
	// from the datastore accessible to the specified user.
	GetCommitListActivity(user *model.User, limit, offset int) ([]*model.CommitRepo, error)

	// GetCommitPrior retrieves the latest commit
	// from the datastore for the specified repository and branch.
	GetCommitPrior(commit *model.Commit) (*model.Commit, error)

	// PostCommit saves a commit in the datastore.
	PostCommit(commit *model.Commit) error

	// PutCommit saves a commit in the datastore.
	PutCommit(commit *model.Commit) error

	// DelCommit removes the commit from the datastore.
	DelCommit(commit *model.Commit) error

	// KillCommits updates all pending or started commits
	// in the datastore settings the status to killed.
	KillCommits() error

	// GetCommitBuildNumber retrieves the monotonically increaing build number
	// from the commit's repo
	GetBuildNumber(commit *model.Commit) (int64, error)
}

type Datastore

type Datastore interface {
	Userstore
	Permstore
	Repostore
	Commitstore
}

func FromContext

func FromContext(c context.Context) Datastore

FromContext returns the sql.DB associated with this context.

type Permstore

type Permstore interface {
	// GetPerm retrieves the User's permission from
	// the datastore for the given repository.
	GetPerm(user *model.User, repo *model.Repo) (*model.Perm, error)

	// PostPerm saves permission in the datastore.
	PostPerm(perm *model.Perm) error

	// PutPerm saves permission in the datastore.
	PutPerm(perm *model.Perm) error

	// DelPerm removes permission from the datastore.
	DelPerm(perm *model.Perm) error
}

type Repostore

type Repostore interface {
	// GetRepo retrieves a specific repo from the
	// datastore for the given ID.
	GetRepo(id int64) (*model.Repo, error)

	// GetRepoName retrieves a repo from the datastore
	// for the specified remote, owner and name.
	GetRepoName(remote, owner, name string) (*model.Repo, error)

	// GetRepoList retrieves a list of all repos from
	// the datastore accessible by the given user ID.
	GetRepoList(user *model.User) ([]*model.Repo, error)

	// PostRepo saves a repo in the datastore.
	PostRepo(repo *model.Repo) error

	// PutRepo saves a repo in the datastore.
	PutRepo(repo *model.Repo) error

	// DelRepo removes the repo from the datastore.
	DelRepo(repo *model.Repo) error
}

type Userstore

type Userstore interface {
	// GetUser retrieves a specific user from the
	// datastore for the given ID.
	GetUser(id int64) (*model.User, error)

	// GetUserLogin retrieves a user from the datastore
	// for the specified remote and login name.
	GetUserLogin(remote, login string) (*model.User, error)

	// GetUserToken retrieves a user from the datastore
	// with the specified token.
	GetUserToken(token string) (*model.User, error)

	// GetUserList retrieves a list of all users from
	// the datastore that are registered in the system.
	GetUserList() ([]*model.User, error)

	// PostUser saves a User in the datastore.
	PostUser(user *model.User) error

	// PutUser saves a user in the datastore.
	PutUser(user *model.User) error

	// DelUser removes the user from the datastore.
	DelUser(user *model.User) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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