Documentation
¶
Index ¶
- Constants
- Variables
- func Connect(o Options) error
- func DeleteConfigResource(ctx context.Context, resourceType string, id string) error
- func DeleteReport(ctx context.Context, id string) error
- func GetConditionConfigs(ctx context.Context, kind, id, config string, limit, page int) ([]model.ConfigCondition, int, error)
- func GetConfigKind(ctx context.Context, resourceType string) ([]string, error)
- func GetSCM(ctx context.Context, id, url, branch string, limit, page int) ([]model.SCM, int, error)
- func GetSourceConfigs(ctx context.Context, kind, id, config string, limit, page int) ([]model.ConfigSource, int, error)
- func GetTargetConfigs(ctx context.Context, kind, id, config string, limit, page int) ([]model.ConfigTarget, int, error)
- func InsertConfigResource(ctx context.Context, resourceType, resourceKind string, ...) (string, error)
- func InsertReport(ctx context.Context, report reports.Report) (string, error)
- func InsertSCM(ctx context.Context, url, branch string) (string, error)
- func RunMigrationUp() error
- func SearchLatestReportByPipelineID(ctx context.Context, id string) (*model.PipelineReport, error)
- func SearchNumberOfReportsByPipelineID(ctx context.Context, id string) (int, error)
- func SearchReport(ctx context.Context, id string) (*model.PipelineReport, error)
- type Options
- type ReportSearchOptions
- type SCMBranchDataset
- type SCMDataset
- type ScmSummaryData
- type SearchLatestReportData
Constants ¶
const (
URIEnvVariableName string = "UDASH_DB_URI"
)
Variables ¶
var ( URI string = os.Getenv(URIEnvVariableName) DB *pgxpool.Pool )
Functions ¶
func DeleteConfigResource ¶ added in v0.11.0
DeleteConfigResource deletes a resource configuration from the database.
func DeleteReport ¶ added in v0.11.0
DeleteReport deletes a report from the database.
func GetConditionConfigs ¶ added in v0.11.0
func GetConditionConfigs(ctx context.Context, kind, id, config string, limit, page int) ([]model.ConfigCondition, int, error)
GetConditionConfigs returns a list of resource configurations from the database.
func GetConfigKind ¶ added in v0.11.0
GetConfigKind returns a list of resource configurations from the database filtered by kind.
func GetSourceConfigs ¶ added in v0.11.0
func GetSourceConfigs(ctx context.Context, kind, id, config string, limit, page int) ([]model.ConfigSource, int, error)
GetSourceConfigs returns a list of resource configurations from the database.
func GetTargetConfigs ¶ added in v0.11.0
func GetTargetConfigs(ctx context.Context, kind, id, config string, limit, page int) ([]model.ConfigTarget, int, error)
GetTargetConfigs returns a list of resource configurations from the database.
func InsertConfigResource ¶ added in v0.11.0
func InsertConfigResource(ctx context.Context, resourceType, resourceKind string, resourceConfig interface{}) (string, error)
InsertConfigResource inserts a new resource configuration into the database.
func InsertReport ¶ added in v0.11.0
InsertReport inserts a new report into the database.
func InsertSCM ¶ added in v0.11.0
InsertSCM creates a new SCM and inserts it into the database.
It returns the ID of the newly created SCM.
func RunMigrationUp ¶
func RunMigrationUp() error
func SearchLatestReportByPipelineID ¶ added in v0.11.0
SearchLatestReportByPipelineID searches the latest report for a specific pipeline id.
func SearchNumberOfReportsByPipelineID ¶ added in v0.11.0
SearchNumberOfReportsByPipelineID searches the number of reports for a specific pipeline id.
func SearchReport ¶ added in v0.11.0
SearchReport searches a report by its database record id.
Types ¶
type ReportSearchOptions ¶ added in v0.11.0
type ReportSearchOptions struct {
// Days is the how far to look back for reports from today.
Days int
}
ReportSearchOptions contains options for searching reports.
type SCMBranchDataset ¶ added in v0.11.0
type SCMBranchDataset map[string]ScmSummaryData
SCMBranchDataset represents a map of branches and their summary data for a single SCM URL.
type SCMDataset ¶ added in v0.11.0
type SCMDataset struct {
Data map[string]SCMBranchDataset `json:"data"`
}
SCMDataset represents the response for the FindSCMSummary endpoint.
func GetSCMSummary ¶ added in v0.11.0
func GetSCMSummary(ctx context.Context, scmRows []model.SCM, totalCount, monitoringDurationDays int) (*SCMDataset, error)
GetSCMSummary returns a list of scms summary from the scm database table.
type ScmSummaryData ¶ added in v0.11.0
type ScmSummaryData struct {
// ID is the unique identifier of the SCM.
ID string `json:"id"`
// TotalResultByType is a map of result types and their counts.
TotalResultByType map[string]int `json:"total_result_by_type"`
// TotalResult is the total number of results for this SCM.
TotalResult int `json:"total_result"`
}
ScmSummaryData represents the summary data for a single SCM.
type SearchLatestReportData ¶ added in v0.11.0
type SearchLatestReportData struct {
// ID represents the unique identifier of the report.
ID string
// Name represents the name of the report.
Name string
// Result represents the result of the report.
Result string
// Report contains the report data.
Report reports.Report
// FilteredResourceID contains the resource config ID that was filtered
// It allows to identify in the report which resource was used to filter the report.
FilteredResourceID string
// CreatedAt represents the creation date of the report.
CreatedAt string
// UpdatedAt represents the last update date of the report.
UpdatedAt string
}
SearchLatestReportData represents a report.
func SearchLatestReport ¶ added in v0.11.0
func SearchLatestReport(ctx context.Context, scmID, sourceID, conditionID, targetID string, options ReportSearchOptions, limit, page int) ([]SearchLatestReportData, int, error)
SearchLatestReport searches the latest reports according some parameters.