database

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2018 License: MIT Imports: 7 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) ChangeJobStatus added in v0.10.1

func (db *Database) ChangeJobStatus(jobID uint, newStatus models.JobStatus) error

ChangeJobStatus will change a job's status. This is not idempotent and will cause an error if the status was not modified.

func (*Database) CreateAccessToken added in v0.9.1

func (db *Database) CreateAccessToken(userID uint, name, token string) (*models.AccessToken, error)

CreateAccessToken will create an access token

func (*Database) CreateArchiveBackport added in v0.20.0

func (db *Database) CreateArchiveBackport(userID uint, packageCount int) (*models.ArchiveBackport, error)

CreateArchiveBackport will create an ArchiveBackport

func (*Database) CreateArchiveUpgrade added in v0.11.0

func (db *Database) CreateArchiveUpgrade(userID uint, packageCount int) (*models.ArchiveUpgrade, error)

CreateArchiveUpgrade will create an ArchiveUpgrade

func (*Database) CreateArtifact added in v0.10.1

func (db *Database) CreateArtifact(jobID uint, filename string) (*models.Artifact, error)

CreateArtifact will create a job artifact

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, input string, buildJobID uint, parentType models.JobParentType, parentID uint) (*models.Job, error)

CreateJob will create a job

func (*Database) CreatePGPKey added in v0.9.1

func (db *Database) CreatePGPKey(userID uint, fingerprint, publicKey string) (*models.PGPKey, error)

CreatePGPKey will create PGP Key

func (*Database) CreateUpload

func (db *Database) CreateUpload(
	userID uint,
	source, version, maintainer, changedBy string,
	autopkgtest bool,
	forward bool,
) (*models.Upload, error)

CreateUpload will create an upload

func (*Database) CreateUser added in v0.9.1

func (db *Database) CreateUser(username string, authBackendUserID uint) (*models.User, error)

CreateUser will create a user

func (*Database) GetAllAccessTokensByToken added in v0.9.1

func (db *Database) GetAllAccessTokensByToken(token string) ([]*models.AccessToken, error)

GetAllAccessTokensByToken returns all AccessTokens that match the userID

func (*Database) GetAllAccessTokensByUserID added in v0.9.1

func (db *Database) GetAllAccessTokensByUserID(userID uint) ([]*models.AccessToken, error)

GetAllAccessTokensByUserID returns all AccessTokens that match the userID

func (*Database) GetAllArchiveBackports added in v0.20.0

func (db *Database) GetAllArchiveBackports() ([]*models.ArchiveBackport, error)

GetAllArchiveBackports returns all ArchiceBackports

func (*Database) GetAllArchiveBackportsByUserID added in v0.20.0

func (db *Database) GetAllArchiveBackportsByUserID(userID uint) ([]*models.ArchiveBackport, error)

GetAllArchiveBackportsByUserID returns all ArchiveBackports for a UserID

func (*Database) GetAllArchiveBackportsPageLimit added in v0.20.0

func (db *Database) GetAllArchiveBackportsPageLimit(page, limit int) ([]*models.ArchiveBackport, error)

GetAllArchiveBackportsPageLimit returns all ArchiveBackports with pagination

func (*Database) GetAllArchiveUpgrades added in v0.11.0

func (db *Database) GetAllArchiveUpgrades() ([]*models.ArchiveUpgrade, error)

GetAllArchiveUpgrades returns all ArchiveUpgrades

func (*Database) GetAllArchiveUpgradesByUserID added in v0.11.0

func (db *Database) GetAllArchiveUpgradesByUserID(userID uint) ([]*models.ArchiveUpgrade, error)

GetAllArchiveUpgradesByUserID returns all ArchiveUpgrades for a UserID

func (*Database) GetAllArchiveUpgradesPageLimit added in v0.12.1

func (db *Database) GetAllArchiveUpgradesPageLimit(page, limit int) ([]*models.ArchiveUpgrade, error)

GetAllArchiveUpgradesPageLimit returns all ArchiveUpgrades with pagination

func (*Database) GetAllArtifactsByJobID added in v0.10.1

func (db *Database) GetAllArtifactsByJobID(jobID uint) ([]*models.Artifact, error)

GetAllArtifactsByJobID returns all job artifacts for a job

func (*Database) GetAllArtifactsByJobIDFilename added in v0.10.1

func (db *Database) GetAllArtifactsByJobIDFilename(jobID uint, filename string) ([]*models.Artifact, error)

GetAllArtifactsByJobIDFilename returns all job artifacts for a job with a matching file name

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) GetAllJobsByArchiveBackportID added in v0.20.0

func (db *Database) GetAllJobsByArchiveBackportID(id uint) ([]*models.Job, error)

GetAllJobsByArchiveBackportID returns all jobs for an upload

func (*Database) GetAllJobsByArchiveBackportIDPageLimit added in v0.20.0

func (db *Database) GetAllJobsByArchiveBackportIDPageLimit(id uint, page, limit int) ([]*models.Job, error)

GetAllJobsByArchiveBackportIDPageLimit returns all jobs for an ArchiveBackport with pagination

func (*Database) GetAllJobsByArchiveUpgradeID added in v0.11.0

func (db *Database) GetAllJobsByArchiveUpgradeID(id uint) ([]*models.Job, error)

GetAllJobsByArchiveUpgradeID returns all jobs for an upload

func (*Database) GetAllJobsByArchiveUpgradeIDPageLimit added in v0.12.1

func (db *Database) GetAllJobsByArchiveUpgradeIDPageLimit(id uint, page, limit int) ([]*models.Job, error)

GetAllJobsByArchiveUpgradeIDPageLimit returns all jobs with pagination

func (*Database) GetAllJobsByParentAndStatuses added in v0.12.1

func (db *Database) GetAllJobsByParentAndStatuses(parentType models.JobParentType, parentID uint, statuses ...models.JobStatus) ([]*models.Job, error)

GetAllJobsByParentAndStatuses returns all jobs that match the given id and statuses

func (*Database) GetAllJobsByUploadID added in v0.9.1

func (db *Database) GetAllJobsByUploadID(uploadID uint) ([]*models.Job, error)

GetAllJobsByUploadID returns all jobs for an upload

func (*Database) GetAllJobsPageLimit added in v0.12.1

func (db *Database) GetAllJobsPageLimit(page, limit int) ([]*models.Job, error)

GetAllJobsPageLimit returns all jobs with pagination

func (*Database) GetAllPGPKeys added in v0.9.1

func (db *Database) GetAllPGPKeys() ([]*models.PGPKey, error)

GetAllPGPKeys returns all PGP Keys

func (*Database) GetAllPGPKeysByFingerprint added in v0.9.1

func (db *Database) GetAllPGPKeysByFingerprint(fingerprint string) ([]*models.PGPKey, error)

GetAllPGPKeysByFingerprint returns all keys that match the given fingerprint

func (*Database) GetAllPGPKeysByUserID added in v0.9.1

func (db *Database) GetAllPGPKeysByUserID(userID uint) ([]*models.PGPKey, error)

GetAllPGPKeysByUserID returns all PGPKeys that match the userID

func (*Database) GetAllUploads

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

GetAllUploads returns all uploads

func (*Database) GetAllUploadsByUserID added in v0.9.1

func (db *Database) GetAllUploadsByUserID(userID uint) ([]*models.Upload, error)

GetAllUploadsByUserID returns all uploads for a user

func (*Database) GetAllUploadsByUserIDPageLimit added in v0.12.1

func (db *Database) GetAllUploadsByUserIDPageLimit(userID uint, page, limit int) ([]*models.Upload, error)

GetAllUploadsByUserIDPageLimit returns all uploads for a given user id with pagination

func (*Database) GetAllUploadsPageLimit added in v0.12.1

func (db *Database) GetAllUploadsPageLimit(page, limit int) ([]*models.Upload, error)

GetAllUploadsPageLimit returns all uploads with pagination

func (*Database) GetArchiveBackport added in v0.20.0

func (db *Database) GetArchiveBackport(id uint) (*models.ArchiveBackport, error)

GetArchiveBackport returns the ArchiveBackport with the given id

func (*Database) GetArchiveUpgrade added in v0.11.0

func (db *Database) GetArchiveUpgrade(id uint) (*models.ArchiveUpgrade, error)

GetArchiveUpgrade returns the ArchiveUpgrade with the given id

func (*Database) GetArtifact added in v0.10.1

func (db *Database) GetArtifact(id uint) (*models.Artifact, error)

GetArtifact returns the Artifact with the given id

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) GetUser added in v0.9.1

func (db *Database) GetUser(id uint) (*models.User, error)

GetUser returns the User with the given id

func (*Database) GetUserByAuthBackendUserID added in v0.14.0

func (db *Database) GetUserByAuthBackendUserID(id uint) (*models.User, error)

GetUserByAuthBackendUserID returns the User with a matching AuthBackendUserID

func (*Database) RemoveAccessToken added in v0.9.1

func (db *Database) RemoveAccessToken(id, userID uint) error

RemoveAccessToken removes all matching access tokens

func (*Database) RemovePGPKey added in v0.9.1

func (db *Database) RemovePGPKey(id, userID uint) error

RemovePGPKey removes all matching pgp keys

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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