store

package
v0.0.0-...-f34f428 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitRepositoryProvider

func InitRepositoryProvider(databaseProvider string)

InitRepositoryProvider - One time init for the given DB Provider

Types

type AnalysisDBStore

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

AnalysisDBStore is a DB-backed Analysis Reports repository

func (*AnalysisDBStore) Delete

func (p *AnalysisDBStore) Delete(userGUID string, id string) error

Delete will delete an Analysis Report from the datastore

func (*AnalysisDBStore) DeleteForEndpoint

func (p *AnalysisDBStore) DeleteForEndpoint(endpointID string) error

DeleteForEndpoint will remove all Analysis Reports for a given endpoint guid

func (*AnalysisDBStore) Get

func (p *AnalysisDBStore) Get(userGUID, ID string) (*AnalysisRecord, error)

Get - Get a specific Analysis Report by ID

func (*AnalysisDBStore) GetLatestCompleted

func (p *AnalysisDBStore) GetLatestCompleted(userGUID, endpointID, path string) (*AnalysisRecord, error)

GetLatestCompleted - Get latest report for the specified path

func (*AnalysisDBStore) List

func (p *AnalysisDBStore) List(userGUID, endpointID string) ([]*AnalysisRecord, error)

List - Returns a list of all user Analysis Reports for the given endpoint

func (*AnalysisDBStore) ListCompletedByPath

func (p *AnalysisDBStore) ListCompletedByPath(userGUID, endpointID, path string) ([]*AnalysisRecord, error)

func (*AnalysisDBStore) ListRunning

func (p *AnalysisDBStore) ListRunning() ([]*AnalysisRecord, error)

func (*AnalysisDBStore) Save

func (p *AnalysisDBStore) Save(report AnalysisRecord) (*AnalysisRecord, error)

Save will persist an Analysis Report to the datastore

func (*AnalysisDBStore) UpdateReport

func (p *AnalysisDBStore) UpdateReport(userGUID string, report *AnalysisRecord) error

UpdateReport will update the dynamic fields of the Analysis Record in thedatastore

type AnalysisRecord

type AnalysisRecord struct {
	ID           string           `json:"id"`
	UserID       string           `json:"-"`
	EndpointType string           `json:"endpointType"`
	EndpointID   string           `json:"endpoint"`
	Type         string           `json:"type"`
	Format       string           `json:"format"`
	Name         string           `json:"name"`
	Path         string           `json:"path"`
	Created      time.Time        `json:"created"`
	Read         bool             `json:"read"`
	Status       string           `json:"status"`
	Duration     int              `json:"duration"`
	Result       string           `json:"-"`
	Error        string           `json:"error"`
	Summary      *json.RawMessage `json:"summary"`
	Report       *json.RawMessage `json:"report,omitempty"`
}

AnalysisRecord represents an analysis that has been run

type AnalysisStore

type AnalysisStore interface {
	List(userGUID, endpointID string) ([]*AnalysisRecord, error)
	Get(userGUID, id string) (*AnalysisRecord, error)
	GetLatestCompleted(userGUID, endpointID, path string) (*AnalysisRecord, error)
	ListCompletedByPath(userGUID, endpointID, path string) ([]*AnalysisRecord, error)
	ListRunning() ([]*AnalysisRecord, error)
	Delete(userGUID, id string) error
	DeleteForEndpoint(endpointID string) error
	Save(record AnalysisRecord) (*AnalysisRecord, error)
	UpdateReport(userGUID string, report *AnalysisRecord) error
}

AnalysisStore is the analysis repository

func NewAnalysisDBStore

func NewAnalysisDBStore(dcp *sql.DB) (AnalysisStore, error)

NewAnalysisDBStore will create a new instance of the AnalysisDBStore

Jump to

Keyboard shortcuts

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