mongodb

package
v0.0.0-...-ef18f62 Latest Latest
Warning

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

Go to latest
Published: May 8, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	ID           bson.ObjectId     `bson:"_id,omitempty" json:"id"`
	Organization string            `bson:"organization" json:"organization"`
	Repository   string            `bson:"repository" json:"repository"`
	Event        string            `bson:"event" json:"event"`
	Branch       string            `bson:"branch" json:"branch"`
	Pipeline     string            `bson:"pipeline" json:"pipeline"`
	Status       string            `bson:"status" json:"status"`
	Error        string            `bson:"error,omitempty" json:"error,omitempty"`
	Start        *time.Time        `bson:"start" json:"start"`
	End          *time.Time        `bson:"end,omitempty" json:"end,omitempty"`
	EnvVars      map[string]string `bson:"envVars" json:"envVars"`
	Tasks        []*BuildTask      `bson:"tasks" json:"tasks"`
}

Build type.

type BuildTask

type BuildTask struct {
	Name    string     `bson:"name" json:"name"`
	Command string     `bson:"command" json:"command"`
	Status  string     `bson:"status" json:"status"`
	Error   string     `bson:"error,omitempty" json:"error,omitempty"`
	Start   *time.Time `bson:"start" json:"start"`
	End     *time.Time `bson:"end,omitempty" json:"end,omitempty"`
}

BuildTask type.

type BuildWriter

type BuildWriter struct {
	Build    *Build
	Counter  int
	Database *Database
}

BuildWriter type.

func NewBuildWriter

func NewBuildWriter(database *Database, organization, repository, event, branch, pipeline string,
	envVars map[string]string) (*BuildWriter, error)

NewBuildWriter is a constructor.

func (*BuildWriter) EndBuild

func (buildWriter *BuildWriter) EndBuild(status, error string) error

EndBuild to update a build with completion status.

func (*BuildWriter) EndBuildTask

func (buildWriter *BuildWriter) EndBuildTask(status, error string) error

EndBuildTask to update a task, with completed status, in a build.

func (*BuildWriter) StartBuildTask

func (buildWriter *BuildWriter) StartBuildTask(name, command string) error

StartBuildTask to insert a task, with "running" status, in a build.

type Config

type Config struct {
	URL string
}

Config type.

type Database

type Database struct {
	Session *mgo.Session
}

Database type.

func NewDatabase

func NewDatabase(mongodbConfig *Config) (*Database, error)

NewDatabase is the constructor for Database.

func (*Database) AddBuildTask

func (database *Database) AddBuildTask(id bson.ObjectId, buildTask *BuildTask) error

AddBuildTask to insert a task in a build.

func (*Database) Close

func (database *Database) Close()

Close to close the mongodb session.

func (*Database) CreateBuild

func (database *Database) CreateBuild(build *Build) error

CreateBuild to insert a new build.

func (*Database) CreateFile

func (database *Database) CreateFile(filename string) (file *mgo.GridFile, err error)

CreateFile to create a file in mongodb with GridFS.

func (*Database) CreateHook

func (database *Database) CreateHook(id int, organization, repository, accessToken string)

CreateHook to create a hook for a repository.

func (*Database) CreateTrigger

func (database *Database) CreateTrigger(trigger *Trigger) error

CreateTrigger to insert a trigger.

func (*Database) DeleteHook

func (database *Database) DeleteHook(id int)

DeleteHook to remove a hook for a repository.

func (*Database) FindBuilds

func (database *Database) FindBuilds() ([]Build, error)

FindBuilds to list the latest 10 builds.

func (*Database) FindHooks

func (database *Database) FindHooks(organization string) []Hook

FindHooks to retrieve the list of hooks available for an organization.

func (*Database) FindRepositoryBuilds

func (database *Database) FindRepositoryBuilds(organization, repository string) ([]Build, error)

FindRepositoryBuilds to list the latest 50 builds of a repository.

func (*Database) FindTriggers

func (database *Database) FindTriggers(organization, repository string) []Trigger

FindTriggers to retrieve the triggers for a repository.

func (*Database) GetHook

func (database *Database) GetHook(organization string, repository string) (Hook, error)

GetHook to get a hook for a repository.

func (*Database) GetRepository

func (database *Database) GetRepository(orgID, repoID string) (*Repository, error)

GetRepository to get a repository (settings).

func (*Database) GetTrigger

func (database *Database) GetTrigger(organization, repository, event, branch string) (*Trigger, error)

GetTrigger to get a trigger for a specific event on a repository.

func (*Database) OpenFile

func (database *Database) OpenFile(filename string) (file *mgo.GridFile, err error)

OpenFile to create a file in mongodb with GridFS.

func (*Database) UpdateBuild

func (database *Database) UpdateBuild(id bson.ObjectId, status, error string, end time.Time) error

UpdateBuild to update the status of a build.

func (*Database) UpdateBuildTask

func (database *Database) UpdateBuildTask(id bson.ObjectId, counter int, status, error string, end time.Time) error

UpdateBuildTask to update a task in a build.

func (*Database) UpdateRepository

func (database *Database) UpdateRepository(repository *Repository) error

UpdateRepository to update a repository (settings).

type Hook

type Hook struct {
	ID           int    `bson:"_id"`
	Organization string `bson:"organization"`
	Repository   string `bson:"repository"`
	AccessToken  string `bson:"accessToken"`
}

Hook type.

type PipelineEnvVar

type PipelineEnvVar struct {
	Name  string `bson:"name" json:"name"`
	Value string `bson:"value" json:"value"`
}

PipelineEnvVar type.

type Repository

type Repository struct {
	OrgID   string           `bson:"organization" json:"orgId"`
	RepoID  string           `bson:"repository" json:"repoId"`
	EnvVars []PipelineEnvVar `bson:"envVars" json:"envVars"`
}

Repository type.

type Trigger

type Trigger struct {
	ID           bson.ObjectId    `bson:"_id,omitempty" json:"id"`
	Organization string           `bson:"organization" json:"organization"`
	Repository   string           `bson:"repository" json:"repository"`
	Event        string           `bson:"event" json:"event"`
	Branch       string           `bson:"branch" json:"branch"`
	Pipeline     string           `bson:"pipeline" json:"pipeline"`
	EnvVars      []PipelineEnvVar `bson:"envVars" json:"envVars"`
}

Trigger type.

Jump to

Keyboard shortcuts

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