database

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(driver, datasource string) (*sql.DB, error)

Connect is a helper function that establishes a new database connection and auto-generates the database schema. If the database already exists, it will perform and update as needed.

func MustConnect

func MustConnect(driver, datasource string) *sql.DB

MustConnect is a helper function that creates a new database connection and auto-generates the database schema. An error causes a panic.

func NewDatastore

func NewDatastore(db *sql.DB) datastore.Datastore

New returns a new Datastore

Types

type Blob

type Blob struct {
	ID   int64  `meddler:"blob_id,pk"`
	Path string `meddler:"blob_path"`
	Data string `meddler:"blob_data,gobgzip"`
}

type Blobstore

type Blobstore struct {
	meddler.DB
}

func NewBlobstore

func NewBlobstore(db meddler.DB) *Blobstore

func (*Blobstore) Del

func (db *Blobstore) Del(path string) error

Del removes an object from the blobstore.

func (*Blobstore) Get

func (db *Blobstore) Get(path string) ([]byte, error)

Get retrieves an object from the blobstore.

func (*Blobstore) GetReader

func (db *Blobstore) GetReader(path string) (io.ReadCloser, error)

GetReader retrieves an object from the blobstore. It is the caller's responsibility to call Close on the ReadCloser when finished reading.

func (*Blobstore) Put

func (db *Blobstore) Put(path string, data []byte) error

Put inserts an object into the blobstore.

func (*Blobstore) PutReader

func (db *Blobstore) PutReader(path string, r io.Reader) error

PutReader inserts an object into the blobstore by consuming data from r until EOF.

type Commitstore

type Commitstore struct {
	meddler.DB
}

func NewCommitstore

func NewCommitstore(db meddler.DB) *Commitstore

func (*Commitstore) DelCommit

func (db *Commitstore) DelCommit(commit *model.Commit) error

DelCommit removes the commit from the datastore.

func (*Commitstore) GetBuildNumber

func (db *Commitstore) GetBuildNumber(commit *model.Commit) (int64, error)

GetBuildNumber retrieves the build number for a commit.

func (*Commitstore) GetCommit

func (db *Commitstore) GetCommit(id int64) (*model.Commit, error)

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

func (*Commitstore) GetCommitLast

func (db *Commitstore) GetCommitLast(repo *model.Repo, branch string) (*model.Commit, error)

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

func (*Commitstore) GetCommitList

func (db *Commitstore) GetCommitList(repo *model.Repo, limit, offset int) ([]*model.Commit, error)

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

func (*Commitstore) GetCommitListActivity

func (db *Commitstore) GetCommitListActivity(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 (*Commitstore) GetCommitListUser

func (db *Commitstore) GetCommitListUser(user *model.User) ([]*model.CommitRepo, error)

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

func (*Commitstore) GetCommitPrior

func (db *Commitstore) GetCommitPrior(oldCommit *model.Commit) (*model.Commit, error)

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

func (*Commitstore) GetCommitSha

func (db *Commitstore) GetCommitSha(repo *model.Repo, branch, sha string) (*model.Commit, error)

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

func (*Commitstore) KillCommits

func (db *Commitstore) KillCommits() error

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

func (*Commitstore) PostCommit

func (db *Commitstore) PostCommit(commit *model.Commit) error

PostCommit saves a commit in the datastore.

func (*Commitstore) PutCommit

func (db *Commitstore) PutCommit(commit *model.Commit) error

PutCommit saves a commit in the datastore.

type Permstore

type Permstore struct {
	meddler.DB
}

func NewPermstore

func NewPermstore(db meddler.DB) *Permstore

func (*Permstore) DelPerm

func (db *Permstore) DelPerm(perm *model.Perm) error

DelPerm removes permission from the datastore.

func (*Permstore) GetPerm

func (db *Permstore) GetPerm(user *model.User, repo *model.Repo) (*model.Perm, error)

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

func (*Permstore) PostPerm

func (db *Permstore) PostPerm(perm *model.Perm) error

PostPerm saves permission in the datastore.

func (*Permstore) PutPerm

func (db *Permstore) PutPerm(perm *model.Perm) error

PutPerm saves permission in the datastore.

type Repostore

type Repostore struct {
	meddler.DB
}

func NewRepostore

func NewRepostore(db meddler.DB) *Repostore

func (*Repostore) DelRepo

func (db *Repostore) DelRepo(repo *model.Repo) error

DelRepo removes the repo from the datastore.

func (*Repostore) GetRepo

func (db *Repostore) GetRepo(id int64) (*model.Repo, error)

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

func (*Repostore) GetRepoList

func (db *Repostore) GetRepoList(user *model.User) ([]*model.Repo, error)

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

func (*Repostore) GetRepoName

func (db *Repostore) GetRepoName(remote, owner, name string) (*model.Repo, error)

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

func (*Repostore) PostRepo

func (db *Repostore) PostRepo(repo *model.Repo) error

PostRepo saves a repo in the datastore.

func (*Repostore) PutRepo

func (db *Repostore) PutRepo(repo *model.Repo) error

PutRepo saves a repo in the datastore.

type Userstore

type Userstore struct {
	meddler.DB
}

func NewUserstore

func NewUserstore(db meddler.DB) *Userstore

func (*Userstore) DelUser

func (db *Userstore) DelUser(user *model.User) error

DelUser removes the user from the datastore.

func (*Userstore) GetUser

func (db *Userstore) GetUser(id int64) (*model.User, error)

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

func (*Userstore) GetUserList

func (db *Userstore) GetUserList() ([]*model.User, error)

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

func (*Userstore) GetUserLogin

func (db *Userstore) GetUserLogin(remote, login string) (*model.User, error)

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

func (*Userstore) GetUserToken

func (db *Userstore) GetUserToken(token string) (*model.User, error)

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

func (*Userstore) PostUser

func (db *Userstore) PostUser(user *model.User) error

PostUser saves a User in the datastore.

func (*Userstore) PutUser

func (db *Userstore) PutUser(user *model.User) error

PutUser saves a user in the datastore.

Jump to

Keyboard shortcuts

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