persist

package
v0.0.0-...-75db7dd Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenDatabase

func OpenDatabase(path string, connectionPtr *DB) error

OpenDatabase opens a QL embedded database connection to a db at a certain path.

Types

type DB

type DB struct {
	Connection *sql.DB
}
var DBConn DB

func (*DB) CreateOutputWriter

func (db *DB) CreateOutputWriter(projectName string, projectOwner string, commitID string,
	job string) (func(string, string) (int64, error), int64, error)

CreateOutputWriter returns a function that can be used to write to the "Output" table. That table is used to write test output to. Test output belongs to a certain job, which in turn belongs to a project. Before returning the writer we make sure these tuples exist or are created. Returns the writer function, the job ID and an error in case anything goes wrong.

func (*DB) FindAllProjects

func (db *DB) FindAllProjects() (*[]Project, error)

FindAllProjects returns all the projects. Used for the webapi get "api/projects/".

func (*DB) FindJobWithData

func (db *DB) FindJobWithData(jobID int64) (*Job, error)

FindJobWithData finds a job and returns it, with all the Output data related to it already fetched.

func (*DB) FindJobsForProject

func (db *DB) FindJobsForProject(projectID int64) ([]Job, error)

Find all jobs that belong to a specific project. This doesn't query the data belonging to every job. Used for the webapi get "api/projects/:ProjectID/jobs".

func (*DB) FindProjectByID

func (db *DB) FindProjectByID(id int64) (*Project, error)

FindProjectById find a single project by its ID. Used for the webapi get "api/projects/:ProjectID".

func (*DB) GetLatestJobID

func (db *DB) GetLatestJobID() int64

GetLatestJobID returns the latest jobID. The return value will be < 1 if no job was found.

func (*DB) UpdateJobStatus

func (db *DB) UpdateJobStatus(jobID int64, status JobStatus, extra string) error

UpdateJobStatus sets the status of a job and allows for some extra information to be passed as string.

type Job

type Job struct {
	ID        int64
	Iteration int64
	Project   int64
	CommitID  string
	Job       string
	Status    string
	Extra     string
	Data      []*Output
}

type JobStatus

type JobStatus int
const (
	STATUS_DONE JobStatus = iota
	STATUS_RUNNING
	STATUS_ERROR
)

type Output

type Output struct {
	ID        int64
	Job       int64
	Data      string
	Timestamp time.Time
}

type Project

type Project struct {
	ID    int64
	Name  string
	Owner string
}

Project struct, fairly self-explanatory.

Jump to

Keyboard shortcuts

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