Version: v0.108.0 Latest Latest

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

Go to latest
Published: Apr 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 4




This section is empty.


This section is empty.


This section is empty.


type Database

type Database struct {
	DB *gorm.DB

Database is a wrapper for the gorm framework.

func New

func New(dialect, connection string, log bool) (*Database, error)

New creates a new wrapper for the gorm database framework.

func (*Database) Close

func (d *Database) Close() error

Close closes the gorm database connection.

func (*Database) CountProjects

func (d *Database) CountProjects() (uint, error)

CountProjects returns the number of projects

func (*Database) CountReports

func (d *Database) CountReports() (uint, error)

CountReports returns the number of reports

func (*Database) CountReportsForProject

func (d *Database) CountReportsForProject(pid uint) (uint, error)

CountReportsForProject returns the number of reports

func (*Database) CreateDetailsBatch

func (d *Database) CreateDetailsBatch(rid uint, s []*model.Detail) (uint, uint)

CreateDetailsBatch creates a batch of details Returns the number successfully created, and the number failed

func (*Database) CreateHistogram

func (d *Database) CreateHistogram(h *model.Histogram) error

CreateHistogram creates a new report

func (*Database) CreateOptions

func (d *Database) CreateOptions(o *model.Options) error

CreateOptions creates a new report

func (*Database) CreateProject

func (d *Database) CreateProject(p *model.Project) error

CreateProject creates a new project

func (*Database) CreateReport

func (d *Database) CreateReport(r *model.Report) error

CreateReport creates a new report

func (*Database) DeleteProject

func (d *Database) DeleteProject(p *model.Project) error

DeleteProject deletas an existing project

func (*Database) DeleteReport

func (d *Database) DeleteReport(r *model.Report) error

DeleteReport deletes an existing report

func (*Database) DeleteReportBulk added in v0.43.0

func (d *Database) DeleteReportBulk(ids []uint) (int, error)

DeleteReportBulk performans a bulk of deletes

func (*Database) FindLatestReportForProject added in v0.27.0

func (d *Database) FindLatestReportForProject(pid uint) (*model.Report, error)

FindLatestReportForProject returns the latest / most recent report for project

func (*Database) FindPreviousReport

func (d *Database) FindPreviousReport(rid uint) (*model.Report, error)

FindPreviousReport find previous report for the report id

func (*Database) FindProjectByID

func (d *Database) FindProjectByID(id uint) (*model.Project, error)

FindProjectByID gets the project by id

func (*Database) FindReportByID

func (d *Database) FindReportByID(id uint) (*model.Report, error)

FindReportByID gets the report by id

func (*Database) GetHistogramForReport

func (d *Database) GetHistogramForReport(rid uint) (*model.Histogram, error)

GetHistogramForReport creates a new report

func (*Database) GetOptionsForReport

func (d *Database) GetOptionsForReport(rid uint) (*model.Options, error)

GetOptionsForReport creates a new report

func (*Database) ListAllDetailsForReport

func (d *Database) ListAllDetailsForReport(rid uint) ([]*model.Detail, error)

ListAllDetailsForReport lists all details for report

func (*Database) ListProjects

func (d *Database) ListProjects(limit, page uint, sortField, order string) ([]*model.Project, error)

ListProjects lists projects using sorting

func (*Database) ListReports

func (d *Database) ListReports(limit, page uint, sortField, order string) ([]*model.Report, error)

ListReports lists reports using sorting

func (*Database) ListReportsForProject

func (d *Database) ListReportsForProject(pid, limit, page uint, sortField, order string) ([]*model.Report, error)

ListReportsForProject lists reports using sorting

func (*Database) UpdateProject

func (d *Database) UpdateProject(p *model.Project) error

UpdateProject update a project

func (*Database) UpdateProjectStatus

func (d *Database) UpdateProjectStatus(pid uint, status model.Status) error

UpdateProjectStatus updates the project's status

Jump to

Keyboard shortcuts

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