database

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package database is responsible for all database logic. It handles connecting to the database and performing queries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database is an implementation of the app.Datastore interface

func NewDatabase

func NewDatabase(driver, connectionString string) (*Database, error)

NewDatabase creates a new database connection

func (*Database) CreateFileUpload added in v0.4.0

func (db *Database) CreateFileUpload(filename, sha256Sum string, uploadedAt time.Time) (*models.FileUpload, error)

CreateFileUpload will create a FileUpload

func (*Database) CreateJob

func (db *Database) CreateJob(jobType models.JobType, uploadID uint) (*models.Job, error)

CreateJob will create a job

func (*Database) CreateUpload

func (db *Database) CreateUpload(source, version, maintainer, changedBy string) (*models.Upload, error)

CreateUpload will create an upload

func (*Database) GetAllFileUploadsByUploadID added in v0.4.0

func (db *Database) GetAllFileUploadsByUploadID(uploadID uint) ([]*models.FileUpload, error)

GetAllFileUploadsByUploadID returns all file uploads for an Upload

func (*Database) GetAllJobs

func (db *Database) GetAllJobs() ([]*models.Job, error)

GetAllJobs returns all jobs

func (*Database) GetAllUploads

func (db *Database) GetAllUploads() ([]*models.Upload, error)

GetAllUploads returns all uploads

func (*Database) GetFileUpload added in v0.4.0

func (db *Database) GetFileUpload(id uint) (*models.FileUpload, error)

GetFileUpload returns the FileUpload with the given id

func (*Database) GetFileUploadByFileNameSHASumCompleted added in v0.4.0

func (db *Database) GetFileUploadByFileNameSHASumCompleted(filename, sha256Sum string, completed bool) (*models.FileUpload, error)

GetFileUploadByFileNameSHASumCompleted returns the first FileUpload that matches

func (*Database) GetJob added in v0.4.0

func (db *Database) GetJob(id uint) (*models.Job, error)

GetJob returns the Job with the given id

func (*Database) GetNextJob added in v0.4.0

func (db *Database) GetNextJob() (*models.Job, error)

GetNextJob will return the next job to run

func (*Database) GetUpload added in v0.4.0

func (db *Database) GetUpload(id uint) (*models.Upload, error)

GetUpload returns the Upload with the given id

func (*Database) UpdateFileUpload added in v0.4.0

func (db *Database) UpdateFileUpload(fileUpload *models.FileUpload) error

UpdateFileUpload will update a file upload

func (*Database) UpdateJob added in v0.4.0

func (db *Database) UpdateJob(job *models.Job) error

UpdateJob will update a job

Jump to

Keyboard shortcuts

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