models

package
v0.0.0-...-8af1e45 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BUILD_STATUS_NOT_START = 0
	BUILD_STATUS_BUILDING  = 1
	BUILD_STATUS_SUCCESS   = 2
	BUILD_STATUS_FAIL      = 3
	BUILD_STATUS_CANCELED  = 4
)
View Source
const (
	PROJECT_STATUS_NEED_TEST = 0
	PROJECT_STATUS_TESTING   = 1
	PROJECT_STATUS_SUCCESS   = 2
	PROJECT_STATUS_FAIL      = 3
)
View Source
const (
	WORKER_STATUS_IDLE = 0
	WORKER_STATUS_BUSY = 1
	WORKER_STATUS_DIE  = 2
)

Variables

This section is empty.

Functions

func AddBuild

func AddBuild(projectName string, branch string, commit string, commitTime time.Time, committer string) error

AddBuild takes basic information to create build.

func AddBuildWithProject

func AddBuildWithProject(project Project) error

AddBuildWithProject take project object to create build.

func AddGithubBuild

func AddGithubBuild(projectId int64, data githubutil.GithubPushHook) error

AddGithubBuild takes github webhook to create build.

func AddGitlabBuild

func AddGitlabBuild(projectId int64, data gitlabutil.GitlabPushHook) error

AddGitlabBuild takes gitlab webhook to create build.

func AddProject

func AddProject(project Project) error

AddProject adds the project in database.

func ReadOrCreateProject

func ReadOrCreateProject(userName string, projectName string, repoUrl string) (int64, error)

ReadOrCreateProject tries to get the project and create it if it doesn't exist.

func RegisterModels

func RegisterModels()

RegisterModels registries the models of archci.

Types

type Build

type Build struct {
	Id          int64 `orm:"pk;auto"`
	ProjectId   int64
	UserName    string    `orm:"size(1024);null"`
	ProjectName string    `orm:"size(1024);null"`
	RepoUrl     string    `orm:"size(1024);null"`
	Branch      string    `orm:"size(1024);null"`
	Commit      string    `orm:"size(1024);null"`
	CommitTime  time.Time `orm:"null"`
	Committer   string    `orm:"size(1024);null"`
	BuildTime   time.Time `orm:"null"`
	FinishTime  time.Time `orm:"null"`
	Worker      string    `orm:"size(1024);null"`
	Status      int       `orm:"null"`
}

Build contains all the information of the build task.

func GetAllBuilds

func GetAllBuilds() []*Build

GetAllBuilds return all builds from database.

func GetBuildWithId

func GetBuildWithId(buildId int64) Build

GetBuildWithId takes build is and return the build.

func GetBuildsWithProjectName

func GetBuildsWithProjectName(projectName string) []*Build

GetBuildsWithProjectName takes project name and return its builds.

type Project

type Project struct {
	Id          int64  `orm:"pk;auto"`
	UserName    string `orm:"size(1024);null"`
	ProjectName string `orm:"size(1024);null"`
	RepoUrl     string `orm:"size(1024);null"`
	Status      int    `orm:"null"`
}

Project contains all the information of project.

func GetAllProjects

func GetAllProjects() []*Project

GetAllProjects return all projects from database.

func GetProjectWithId

func GetProjectWithId(projectId int64) Project

GetProjectWithId takes id to return the project.

type Worker

type Worker struct {
	Id         int64  `orm:"pk;auto"`
	Ip         string `orm:"size(1024)"`
	LastUpdate time.Time
	Status     int
}

Worker contains all the information of the worker.

func GetAllWorkers

func GetAllWorkers() []*Worker

GetAllWorkers return all the workers from database.

func GetAllWorkersWithStatus

func GetAllWorkersWithStatus(status int) []*Worker

GetAllWorkersWithStatus takes the status and return the workers.

Jump to

Keyboard shortcuts

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