api

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationInfo

type ApplicationInfo struct {
	Version   string
	GOVersion string
	BuildDate string
	StartTime time.Time
}

ApplicationInfo contains info about the app

type DeleteReportBulkRequest

type DeleteReportBulkRequest struct {
	IDs []uint `json:"ids"`
}

DeleteReportBulkRequest is the request to delete bulk reports

type DetailsCreated

type DetailsCreated struct {
	// Number of successfully created detail objects
	Success uint `json:"success"`

	// Number of failed detail objects
	Fail uint `json:"fail"`
}

DetailsCreated summary of how many details got created and how many failed

type ExportAPI

type ExportAPI struct {
	DB ExportDatabase
}

The ExportAPI provides handlers.

func (*ExportAPI) GetExport

func (api *ExportAPI) GetExport(ctx echo.Context) error

GetExport does export for the report

type ExportDatabase

type ExportDatabase interface {
	FindReportByID(uint) (*model.Report, error)
	GetHistogramForReport(uint) (*model.Histogram, error)
	GetOptionsForReport(uint) (*model.Options, error)
	ListAllDetailsForReport(uint) ([]*model.Detail, error)
}

ExportDatabase interface for encapsulating database access.

type HistogramAPI

type HistogramAPI struct {
	DB HistogramDatabase
}

The HistogramAPI provides handlers.

func (*HistogramAPI) GetHistogram

func (api *HistogramAPI) GetHistogram(ctx echo.Context) error

GetHistogram gets a histogram for the report

type HistogramDatabase

type HistogramDatabase interface {
	GetHistogramForReport(uint) (*model.Histogram, error)
}

HistogramDatabase interface for encapsulating database access.

type InfoAPI

type InfoAPI struct {
	Info ApplicationInfo
}

The InfoAPI provides handlers for managing projects.

func (*InfoAPI) GetApplicationInfo

func (api *InfoAPI) GetApplicationInfo(ctx echo.Context) error

GetApplicationInfo gets application info

type InfoResponse

type InfoResponse struct {
	// Version of the application
	Version string `json:"version"`

	// Go runtime version
	RuntimeVersion string `json:"runtimeVersion"`

	// The build date of the server application
	BuildDate string `json:"buildDate"`

	// Uptime of the server
	Uptime string `json:"uptime"`

	// Memory info
	MemoryInfo *MemoryInfo `json:"memoryInfo,omitempty"`
}

InfoResponse is the info response

type IngestAPI

type IngestAPI struct {
	DB IngestDatabase
}

The IngestAPI provides handlers for ingesting and processing reports.

func (*IngestAPI) Ingest

func (api *IngestAPI) Ingest(ctx echo.Context) error

Ingest creates data from raw report

func (*IngestAPI) IngestToProject

func (api *IngestAPI) IngestToProject(ctx echo.Context) error

IngestToProject ingests data into a specific project

type IngestDatabase

type IngestDatabase interface {
	CreateProject(*model.Project) error
	CreateReport(*model.Report) error
	CreateHistogram(*model.Histogram) error
	CreateOptions(*model.Options) error
	FindProjectByID(uint) (*model.Project, error)
	FindLatestReportForProject(uint) (*model.Report, error)
	CreateDetailsBatch(uint, []*model.Detail) (uint, uint)
	UpdateProjectStatus(uint, model.Status) error
}

IngestDatabase interface for encapsulating database access.

type IngestRequest

type IngestRequest runner.Report

IngestRequest is the raw report

type IngestResponse

type IngestResponse struct {
	// Created project
	Project *model.Project `json:"project"`

	// Created report
	Report *model.Report `json:"report"`

	// Created Options
	Options *model.Options `json:"options"`

	// Created Histogram
	Histogram *model.Histogram `json:"histogram"`

	// The summary of created details
	Details *DetailsCreated `json:"details"`
}

IngestResponse is the response to the ingest endpoint

type JSONExportRespose

type JSONExportRespose struct {
	model.Report

	Options *model.OptionsInfo `json:"options,omitempty"`

	Histogram model.BucketList `json:"histogram"`

	Details []*runner.ResultDetail `json:"details"`
}

JSONExportRespose is the response to JSON export

type MemoryInfo

type MemoryInfo struct {
	// Bytes of allocated heap objects.
	Alloc uint64 `json:"allocated"`

	// Cumulative bytes allocated for heap objects.
	TotalAlloc uint64 `json:"totalAllocated"`

	// The total bytes of memory obtained from the OS.
	System uint64 `json:"system"`

	// The number of pointer lookups performed by the runtime.
	Lookups uint64 `json:"lookups"`

	// The cumulative count of heap objects allocated.
	// The number of live objects is Mallocs - Frees.
	Mallocs uint64 `json:"mallocs"`

	// The cumulative count of heap objects freed.
	Frees uint64 `json:"frees"`

	// The number of completed GC cycles.
	NumGC uint32 `json:"numGC"`
}

MemoryInfo some memory stats

type OptionsAPI

type OptionsAPI struct {
	DB OptionsDatabase
}

The OptionsAPI provides handlers

func (*OptionsAPI) GetOptions

func (api *OptionsAPI) GetOptions(ctx echo.Context) error

GetOptions gets options for a report

type OptionsDatabase

type OptionsDatabase interface {
	GetOptionsForReport(uint) (*model.Options, error)
}

OptionsDatabase interface for encapsulating database access.

type ProjectAPI

type ProjectAPI struct {
	DB ProjectDatabase
}

The ProjectAPI provides handlers for managing projects.

func (*ProjectAPI) CreateProject

func (api *ProjectAPI) CreateProject(ctx echo.Context) error

CreateProject creates a project

func (*ProjectAPI) DeleteProject

func (api *ProjectAPI) DeleteProject(ctx echo.Context) error

DeleteProject deletes a project

func (*ProjectAPI) GetProject

func (api *ProjectAPI) GetProject(ctx echo.Context) error

GetProject gets a project

func (*ProjectAPI) ListProjects

func (api *ProjectAPI) ListProjects(ctx echo.Context) error

ListProjects lists projects

func (*ProjectAPI) UpdateProject

func (api *ProjectAPI) UpdateProject(ctx echo.Context) error

UpdateProject updates a project

type ProjectDatabase

type ProjectDatabase interface {
	CreateProject(project *model.Project) error
	FindProjectByID(id uint) (*model.Project, error)
	UpdateProject(*model.Project) error
	DeleteProject(*model.Project) error
	CountProjects() (uint, error)
	ListProjects(limit, page uint, sortField, order string) ([]*model.Project, error)
}

ProjectDatabase interface for encapsulating database access.

type ProjectList

type ProjectList struct {
	Total uint             `json:"total"`
	Data  []*model.Project `json:"data"`
}

ProjectList response

type ReportAPI

type ReportAPI struct {
	DB ReportDatabase
}

The ReportAPI provides handlers for managing reports.

func (*ReportAPI) DeleteReport

func (api *ReportAPI) DeleteReport(ctx echo.Context) error

DeleteReport deletes a report

func (*ReportAPI) DeleteReportBulk

func (api *ReportAPI) DeleteReportBulk(ctx echo.Context) error

DeleteReportBulk deletes bulk reports

func (*ReportAPI) GetPreviousReport

func (api *ReportAPI) GetPreviousReport(ctx echo.Context) error

GetPreviousReport gets a previous report

func (*ReportAPI) GetReport

func (api *ReportAPI) GetReport(ctx echo.Context) error

GetReport gets a report

func (*ReportAPI) ListReportsAll

func (api *ReportAPI) ListReportsAll(ctx echo.Context) error

ListReportsAll gets a list of all reports

func (*ReportAPI) ListReportsForProject

func (api *ReportAPI) ListReportsForProject(ctx echo.Context) error

ListReportsForProject lists reports for a project

type ReportDatabase

type ReportDatabase interface {
	CountReports() (uint, error)
	CountReportsForProject(uint) (uint, error)
	FindReportByID(uint) (*model.Report, error)
	FindPreviousReport(uint) (*model.Report, error)
	DeleteReport(*model.Report) error
	DeleteReportBulk([]uint) (int, error)
	ListReports(limit, page uint, sortField, order string) ([]*model.Report, error)
	ListReportsForProject(pid, limit, page uint, sortField, order string) ([]*model.Report, error)
}

ReportDatabase interface for encapsulating database access.

type ReportList

type ReportList struct {
	Total uint            `json:"total"`
	Data  []*model.Report `json:"data"`
}

ReportList response

Jump to

Keyboard shortcuts

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