Documentation
¶
Index ¶
- Constants
- Variables
- func AssociateId(db Db, tableName string, tablePrefix string, prefix1 string, id1 int64, ...) error
- func AssociateIdWithVal(db Db, tableName string, tablePrefix string, prefix1 string, id1 int64, ...) error
- func ColumnName(f entity.OrderByField) string
- func Connect(cfg util.Config) (*sqlx.DB, error)
- func CreateCursorParameters(params []any, fields []Field) []any
- func CreateCursorQuery(query string, fields []Field) string
- func DependentJoin[T any](T, *Order) bool
- func DissociateAllIds(db Db, tableName string, tablePrefix string, prefix string, id int64) error
- func DissociateId(db Db, tableName string, tablePrefix string, prefix1 string, id1 int64, ...) error
- func EncodeCursor(opts ...NewCursor) (string, error)
- func EnsureFilter[T entity.Filter](filter T) T
- func GetBoolValue(v sql.NullBool) bool
- func GetCursorQueryParameters(pagFirst *int, cursorFields []Field) []any
- func GetDefaultOrder(order []entity.Order, by entity.OrderByField, direction entity.OrderDirection) []entity.Order
- func GetInt16Value(v sql.NullInt16) int16
- func GetInt64Value(v sql.NullInt64) int64
- func GetSqlxConnection(cfg util.Config) (*sqlx.DB, error)
- func GetSqlxRootConnection(cfg util.Config) (*sqlx.DB, error)
- func GetStringValue(v sql.NullString) string
- func GetTimeValue(v sql.NullTime) time.Time
- func GetUserTypeValue(v sql.NullInt64) entity.UserType
- func GetVersion(cfg util.Config) (string, error)
- func IsValidId(id int64) bool
- func OrderDirectionStr(dir entity.OrderDirection) string
- func PerformExecArgs(db Db, query string, args []any, l *logrus.Entry) (sql.Result, error)
- func PerformInsertArgs(db Db, query string, args []any, l *logrus.Entry) (int64, error)
- func RunMigrations(cfg util.Config) error
- func RunMigrationsSync(cfg util.Config) error
- func ToJsonSlice(in []any) []*entity.Json
- func ToStateSlice(in []any) []entity.StateFilterType
- func ValueOrDefault[T any](p *T, def T) T
- func WrapBuilder[T any](build func([]T) string) func([]any) string
- func WrapConvertRetSlice[T any, R any](fn func(T) any) func(T) []R
- type Attr
- type BaseIssueRepositoryRow
- type BaseServiceRow
- type ComponentInstanceRow
- func (cir ComponentInstanceRow) AsComponentInstance() entity.ComponentInstance
- func (cir *ComponentInstanceRow) FromComponentInstance(ci *entity.ComponentInstance)
- func (cir *ComponentInstanceRow) FromEntity(ci *entity.ComponentInstance)
- func (cir *ComponentInstanceRow) ToEntity() *entity.ComponentInstance
- type ComponentRow
- type ComponentVersionIssueRow
- type ComponentVersionRow
- type DatabaseRow
- type Db
- type DbObject
- func (do *DbObject[ET, ETFilter, ETResult]) AddCursor(qb sq.SelectBuilder, filter entity.Filter, cursorFields []Field) sq.SelectBuilder
- func (do *DbObject[ET, ETFilter, ETResult]) AddFilter(qb sq.SelectBuilder, filter ETFilter) sq.SelectBuilder
- func (do *DbObject[ET, ETFilter, ETResult]) AddJoins(qb sq.SelectBuilder, filter ETFilter, order *Order) sq.SelectBuilder
- func (do *DbObject[ET, ETFilter, ETResult]) Count(ctx context.Context, db Db, filter ETFilter) (int64, error)
- func (do *DbObject[ET, ETFilter, ETResult]) Create(db Db, entityItem ET) (ET, error)
- func (do *DbObject[ET, ETFilter, ETResult]) Delete(db Db, id int64, userId int64) error
- func (do *DbObject[ET, ETFilter, ETResult]) Get(ctx context.Context, db Db, filter ETFilter, order []entity.Order) ([]ETResult, error)
- func (do *DbObject[ET, ETFilter, ETResult]) GetAllCursors(ctx context.Context, db Db, filter ETFilter, order []entity.Order) ([]string, error)
- func (do *DbObject[ET, ETFilter, ETResult]) GetAllIds(ctx context.Context, db Db, filter ETFilter) ([]int64, error)
- func (do *DbObject[ET, ETFilter, ETResult]) GetAttr(ctx context.Context, db Db, attrName string, filter ETFilter) ([]string, error)
- func (do *DbObject[ET, ETFilter, ETResult]) GetFilterParameters_tmp(filter ETFilter, withCursor bool, cursorFields []Field) []any
- func (do *DbObject[ET, ETFilter, ETResult]) GetFilterQuery_tmp(filter ETFilter) string
- func (do *DbObject[ET, ETFilter, ETResult]) GetFilterWhereClause_tmp(filter ETFilter, withCursor bool) string
- func (do *DbObject[ET, ETFilter, ETResult]) GetJoins_tmp(filter ETFilter, order *Order) string
- func (do *DbObject[ET, ETFilter, ETResult]) InsertQuery(entityItem ET) (string, []any, error)
- func (do *DbObject[ET, ETFilter, ETResult]) Update(db Db, entityItem ET) error
- type Field
- type FilterProperty
- func NewCustomFilterProperty[T any](buildQuery func([]any) string, getParam func(T) any) *FilterProperty[T]
- func NewFilterProperty[T any](query string, param func(T) any) *FilterProperty[T]
- func NewJsonFilterProperty[T any](query string, param func(T) any) *FilterProperty[T]
- func NewNFilterProperty[T any](query string, param func(T) any, nparam int) *FilterProperty[T]
- func NewStateFilterProperty[T any](prefix string, param func(T) any) *FilterProperty[T]
- type GetIssuesByRow
- type GetServicesByRow
- type IssueAggregationsRow
- type IssueCountRow
- type IssueMatchRow
- type IssueRepositoryRow
- type IssueRepositoryServiceRow
- type IssueRow
- type IssueVariantRow
- type IssueVariantWithRepository
- type JoinDef
- type JoinResolver
- type JoinType
- type NamedStmt
- type NewCursor
- func WithComponent(order []entity.Order, c entity.Component, isc entity.IssueSeverityCounts) NewCursor
- func WithComponentInstance(order []entity.Order, ci entity.ComponentInstance) NewCursor
- func WithComponentVersion(order []entity.Order, cv entity.ComponentVersion, ...) NewCursor
- func WithIssue(order []entity.Order, issue entity.Issue, ivRating int64) NewCursor
- func WithIssueMatch(order []entity.Order, im entity.IssueMatch) NewCursor
- func WithIssueRepository(order []entity.Order, r entity.IssueRepository) NewCursor
- func WithIssueVariant(order []entity.Order, r entity.IssueVariant) NewCursor
- func WithPatch(order []entity.Order, p entity.Patch) NewCursor
- func WithRemediation(order []entity.Order, r entity.Remediation) NewCursor
- func WithService(order []entity.Order, s entity.Service, isc entity.IssueSeverityCounts) NewCursor
- func WithServiceIssueVariant(order []entity.Order, r entity.ServiceIssueVariant) NewCursor
- func WithSupportGroup(order []entity.Order, sg entity.SupportGroup) NewCursor
- func WithUser(order []entity.Order, r entity.User) NewCursor
- type Object
- type Order
- func (o Order) By(fields ...entity.OrderByField) bool
- func (o Order) ByCiCcrn() bool
- func (o Order) ByCount() bool
- func (o Order) ByIssuePrimaryName() bool
- func (o Order) ByRating() bool
- func (o Order) Sequence() []entity.Order
- func (o Order) ToSql() string
- func (o Order) ToSqlWithPrefixAll(prefix string) string
- type OwnerRow
- type PatchRow
- type Property
- type QuietDb
- func (qdb *QuietDb) Close() error
- func (qdb *QuietDb) Exec(query string, args ...any) (sql.Result, error)
- func (qdb *QuietDb) Get(dest any, query string, args ...any) error
- func (qdb *QuietDb) GetDbInstance() *sql.DB
- func (qdb *QuietDb) PrepareNamed(query string) (NamedStmt, error)
- func (qdb *QuietDb) Preparex(query string) (Stmt, error)
- func (qdb *QuietDb) PreparexContext(ctx context.Context, query string) (Stmt, error)
- func (qdb *QuietDb) Query(query string, args ...any) (SqlRows, error)
- func (qdb *QuietDb) QueryContext(ctx context.Context, query string, args ...any) (SqlRows, error)
- func (qdb *QuietDb) QueryRow(query string, args ...any) *sql.Row
- func (qdb *QuietDb) Select(dest any, query string, args ...any) error
- type RatingCount
- type RemediationRow
- type Row
- type RowComposite
- type ScannerRunRow
- type ServiceAggregationsRow
- type ServiceIssueVariantRow
- type ServiceRow
- type SqlDatabase
- func (s *SqlDatabase) AddComponentVersionToIssue(issueId int64, componentVersionId int64) error
- func (s *SqlDatabase) AddIssueRepositoryToService(serviceId int64, issueRepositoryId int64, priority int64) error
- func (s *SqlDatabase) AddOwnerToService(serviceId int64, userId int64) error
- func (s *SqlDatabase) AddServiceToSupportGroup(supportGroupId int64, serviceId int64) error
- func (s *SqlDatabase) AddUserToSupportGroup(supportGroupId int64, userId int64) error
- func (s *SqlDatabase) Autopatch(ctx context.Context) (bool, error)
- func (s *SqlDatabase) CloseConnection() error
- func (s *SqlDatabase) CompleteScannerRun(uuid string) (bool, error)
- func (s *SqlDatabase) ConnectDB(dbName string) error
- func (s *SqlDatabase) CountComponentInstances(ctx context.Context, filter *entity.ComponentInstanceFilter) (int64, error)
- func (s *SqlDatabase) CountComponentVersions(ctx context.Context, filter *entity.ComponentVersionFilter) (int64, error)
- func (s *SqlDatabase) CountComponentVulnerabilities(ctx context.Context, filter *entity.ComponentFilter) ([]entity.IssueSeverityCounts, error)
- func (s *SqlDatabase) CountComponents(ctx context.Context, filter *entity.ComponentFilter) (int64, error)
- func (s *SqlDatabase) CountIssueMatches(ctx context.Context, filter *entity.IssueMatchFilter) (int64, error)
- func (s *SqlDatabase) CountIssueRatings(ctx context.Context, filter *entity.IssueFilter) (*entity.IssueSeverityCounts, error)
- func (s *SqlDatabase) CountIssueRepositories(ctx context.Context, filter *entity.IssueRepositoryFilter) (int64, error)
- func (s *SqlDatabase) CountIssueTypes(ctx context.Context, filter *entity.IssueFilter) (*entity.IssueTypeCounts, error)
- func (s *SqlDatabase) CountIssueVariants(ctx context.Context, filter *entity.IssueVariantFilter) (int64, error)
- func (s *SqlDatabase) CountIssues(ctx context.Context, filter *entity.IssueFilter) (int64, error)
- func (s *SqlDatabase) CountPatches(ctx context.Context, filter *entity.PatchFilter) (int64, error)
- func (s *SqlDatabase) CountRemediations(ctx context.Context, filter *entity.RemediationFilter) (int64, error)
- func (s *SqlDatabase) CountScannerRuns(filter *entity.ScannerRunFilter) (int, error)
- func (s *SqlDatabase) CountServices(ctx context.Context, filter *entity.ServiceFilter) (int64, error)
- func (s *SqlDatabase) CountSupportGroups(ctx context.Context, filter *entity.SupportGroupFilter) (int64, error)
- func (s *SqlDatabase) CountUsers(ctx context.Context, filter *entity.UserFilter) (int64, error)
- func (s *SqlDatabase) CreateComponent(component *entity.Component) (*entity.Component, error)
- func (s *SqlDatabase) CreateComponentInstance(componentInstance *entity.ComponentInstance) (*entity.ComponentInstance, error)
- func (s *SqlDatabase) CreateComponentVersion(componentVersion *entity.ComponentVersion) (*entity.ComponentVersion, error)
- func (s *SqlDatabase) CreateIssue(issue *entity.Issue) (*entity.Issue, error)
- func (s *SqlDatabase) CreateIssueMatch(issueMatch *entity.IssueMatch) (*entity.IssueMatch, error)
- func (s *SqlDatabase) CreateIssueRepository(issueRepository *entity.IssueRepository) (*entity.IssueRepository, error)
- func (s *SqlDatabase) CreateIssueVariant(issueVariant *entity.IssueVariant) (*entity.IssueVariant, error)
- func (s *SqlDatabase) CreateRemediation(remediation *entity.Remediation) (*entity.Remediation, error)
- func (s *SqlDatabase) CreateScannerRun(scannerRun *entity.ScannerRun) (bool, error)
- func (s *SqlDatabase) CreateScannerRunComponentInstanceTracker(componentInstanceId int64, scannerRunUUID string) error
- func (s *SqlDatabase) CreateService(service *entity.Service) (*entity.Service, error)
- func (s *SqlDatabase) CreateSupportGroup(supportGroup *entity.SupportGroup) (*entity.SupportGroup, error)
- func (s *SqlDatabase) CreateUser(user *entity.User) (*entity.User, error)
- func (s *SqlDatabase) DeleteComponent(id int64, userId int64) error
- func (s *SqlDatabase) DeleteComponentInstance(id int64, userId int64) error
- func (s *SqlDatabase) DeleteComponentVersion(id int64, userId int64) error
- func (s *SqlDatabase) DeleteIssue(id int64, userId int64) error
- func (s *SqlDatabase) DeleteIssueMatch(id int64, userId int64) error
- func (s *SqlDatabase) DeleteIssueRepository(id int64, userId int64) error
- func (s *SqlDatabase) DeleteIssueVariant(id int64, userId int64) error
- func (s *SqlDatabase) DeleteRemediation(id int64, userId int64) error
- func (s *SqlDatabase) DeleteService(id int64, userId int64) error
- func (s *SqlDatabase) DeleteSupportGroup(id int64, userId int64) error
- func (s *SqlDatabase) DeleteUser(id int64, userId int64) error
- func (s *SqlDatabase) DropSchema(name string) error
- func (s *SqlDatabase) FailScannerRun(uuid string, message string) (bool, error)
- func (s *SqlDatabase) GetAllComponentCursors(ctx context.Context, filter *entity.ComponentFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllComponentInstanceCursors(ctx context.Context, filter *entity.ComponentInstanceFilter, ...) ([]string, error)
- func (s *SqlDatabase) GetAllComponentVersionCursors(ctx context.Context, filter *entity.ComponentVersionFilter, ...) ([]string, error)
- func (s *SqlDatabase) GetAllIssueCursors(ctx context.Context, filter *entity.IssueFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllIssueMatchCursors(ctx context.Context, filter *entity.IssueMatchFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllIssueMatchIds(ctx context.Context, filter *entity.IssueMatchFilter) ([]int64, error)
- func (s *SqlDatabase) GetAllIssueRepositoryCursors(ctx context.Context, filter *entity.IssueRepositoryFilter, ...) ([]string, error)
- func (s *SqlDatabase) GetAllIssueVariantCursors(ctx context.Context, filter *entity.IssueVariantFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllPatchCursors(ctx context.Context, filter *entity.PatchFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllRemediationCursors(ctx context.Context, filter *entity.RemediationFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllServiceCursors(ctx context.Context, filter *entity.ServiceFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllSupportGroupCursors(ctx context.Context, filter *entity.SupportGroupFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllUserCursors(ctx context.Context, filter *entity.UserFilter, order []entity.Order) ([]string, error)
- func (s *SqlDatabase) GetAllUserIds(ctx context.Context, filter *entity.UserFilter) ([]int64, error)
- func (s *SqlDatabase) GetCcrn(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetCluster(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetComponentCcrns(ctx context.Context, filter *entity.ComponentFilter) ([]string, error)
- func (s *SqlDatabase) GetComponentInstanceParent(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetComponentInstances(ctx context.Context, filter *entity.ComponentInstanceFilter, ...) ([]entity.ComponentInstanceResult, error)
- func (s *SqlDatabase) GetComponentVersions(ctx context.Context, filter *entity.ComponentVersionFilter, ...) ([]entity.ComponentVersionResult, error)
- func (s *SqlDatabase) GetComponents(ctx context.Context, filter *entity.ComponentFilter, order []entity.Order) ([]entity.ComponentResult, error)
- func (s *SqlDatabase) GetContainer(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetContext(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetDefaultIssuePriority() int64
- func (s *SqlDatabase) GetDefaultRepositoryName() string
- func (s *SqlDatabase) GetDomain(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetEarliestRemediationByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]time.Time, error)
- func (s *SqlDatabase) GetIssueCountsByComponentIDs(ctx context.Context, componentIDs []int64, serviceCCRN []*string) (map[int64]entity.IssueSeverityCounts, error)
- func (s *SqlDatabase) GetIssueCountsByServiceIDs(ctx context.Context, serviceIDs []int64) (map[int64]entity.IssueSeverityCounts, error)
- func (s *SqlDatabase) GetIssueMatches(ctx context.Context, filter *entity.IssueMatchFilter, order []entity.Order) ([]entity.IssueMatchResult, error)
- func (s *SqlDatabase) GetIssueNames(ctx context.Context, filter *entity.IssueFilter) ([]string, error)
- func (s *SqlDatabase) GetIssueRepositories(ctx context.Context, filter *entity.IssueRepositoryFilter, ...) ([]entity.IssueRepositoryResult, error)
- func (s *SqlDatabase) GetIssueVariants(ctx context.Context, filter *entity.IssueVariantFilter, order []entity.Order) ([]entity.IssueVariantResult, error)
- func (s *SqlDatabase) GetIssues(ctx context.Context, filter *entity.IssueFilter, order []entity.Order) ([]entity.IssueResult, error)
- func (s *SqlDatabase) GetIssuesWithAggregations(ctx context.Context, filter *entity.IssueFilter, order []entity.Order) ([]entity.IssueResult, error)
- func (s *SqlDatabase) GetMaxSeverityByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]string, error)
- func (s *SqlDatabase) GetNamespace(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetOwnersByServiceIDs(ctx context.Context, serviceIDs []int64) (map[int64][]entity.User, error)
- func (s *SqlDatabase) GetPatches(ctx context.Context, filter *entity.PatchFilter, order []entity.Order) ([]entity.PatchResult, error)
- func (s *SqlDatabase) GetPod(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetProject(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetRegion(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetRemediations(ctx context.Context, filter *entity.RemediationFilter, order []entity.Order) ([]entity.RemediationResult, error)
- func (s *SqlDatabase) GetScannerRunTags() ([]string, error)
- func (s *SqlDatabase) GetScannerRuns(filter *entity.ScannerRunFilter) ([]entity.ScannerRun, error)
- func (s *SqlDatabase) GetServiceCcrns(ctx context.Context, filter *entity.ServiceFilter) ([]string, error)
- func (s *SqlDatabase) GetServiceDomains(ctx context.Context, filter *entity.ServiceFilter) ([]string, error)
- func (s *SqlDatabase) GetServiceIssueVariants(ctx context.Context, filter *entity.ServiceIssueVariantFilter, ...) ([]entity.ServiceIssueVariantResult, error)
- func (s *SqlDatabase) GetServiceRegions(ctx context.Context, filter *entity.ServiceFilter) ([]string, error)
- func (s *SqlDatabase) GetServices(ctx context.Context, filter *entity.ServiceFilter, order []entity.Order) ([]entity.ServiceResult, error)
- func (s *SqlDatabase) GetServicesByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64][]entity.ServiceResult, error)
- func (s *SqlDatabase) GetServicesWithAggregations(ctx context.Context, filter *entity.ServiceFilter, order []entity.Order) ([]entity.ServiceResult, error)
- func (s *SqlDatabase) GetSourceURLsByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]string, error)
- func (s *SqlDatabase) GetSupportGroupCcrns(ctx context.Context, filter *entity.SupportGroupFilter) ([]string, error)
- func (s *SqlDatabase) GetSupportGroups(ctx context.Context, filter *entity.SupportGroupFilter, order []entity.Order) ([]entity.SupportGroupResult, error)
- func (s *SqlDatabase) GetSupportGroupsByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64][]entity.SupportGroupResult, error)
- func (s *SqlDatabase) GetSupportGroupsByServiceIDs(ctx context.Context, serviceIDs []int64) (map[int64][]entity.SupportGroup, error)
- func (s *SqlDatabase) GetType(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
- func (s *SqlDatabase) GetUniqueUserIDs(ctx context.Context, filter *entity.UserFilter) ([]string, error)
- func (s *SqlDatabase) GetUserNames(ctx context.Context, filter *entity.UserFilter) ([]string, error)
- func (s *SqlDatabase) GetUsers(ctx context.Context, filter *entity.UserFilter) ([]entity.UserResult, error)
- func (s *SqlDatabase) GetVersionsByComponentIDs(ctx context.Context, componentIDs []int64, serviceCCRN []*string) (map[int64][]entity.ComponentVersionResult, error)
- func (s *SqlDatabase) GetVulnerabilitiesByComponentIDs(ctx context.Context, componentIDs []int64) (map[int64][]entity.VulnerabilityResult, error)
- func (s *SqlDatabase) GetVulnerabilityAggregatesByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]entity.VulnerabilityAggregate, error)
- func (s *SqlDatabase) GetVulnerabilityCountsByComponentIDs(ctx context.Context, componentIDs []int64) (map[int64]int, error)
- func (s *SqlDatabase) GrantAccess(username string, database string, host string) error
- func (s *SqlDatabase) RemoveAllIssuesFromComponentVersion(componentVersionId int64) error
- func (s *SqlDatabase) RemoveComponentVersionFromIssue(issueId int64, componentVersionId int64) error
- func (s *SqlDatabase) RemoveIssueRepositoryFromService(serviceId int64, issueRepositoryId int64) error
- func (s *SqlDatabase) RemoveOwnerFromService(serviceId int64, userId int64) error
- func (s *SqlDatabase) RemoveServiceFromSupportGroup(supportGroupId int64, serviceId int64) error
- func (s *SqlDatabase) RemoveUserFromSupportGroup(supportGroupId int64, userId int64) error
- func (s *SqlDatabase) ScannerRunByUUID(uuid string) (*entity.ScannerRun, error)
- func (s *SqlDatabase) UpdateComponent(component *entity.Component) error
- func (s *SqlDatabase) UpdateComponentInstance(componentInstance *entity.ComponentInstance) error
- func (s *SqlDatabase) UpdateComponentVersion(componentVersion *entity.ComponentVersion) error
- func (s *SqlDatabase) UpdateIssue(issue *entity.Issue) error
- func (s *SqlDatabase) UpdateIssueMatch(issueMatch *entity.IssueMatch) error
- func (s *SqlDatabase) UpdateIssueRepository(issueRepository *entity.IssueRepository) error
- func (s *SqlDatabase) UpdateIssueVariant(issueVariant *entity.IssueVariant) error
- func (s *SqlDatabase) UpdateRemediation(remediation *entity.Remediation) error
- func (s *SqlDatabase) UpdateService(service *entity.Service) error
- func (s *SqlDatabase) UpdateSupportGroup(supportGroup *entity.SupportGroup) error
- func (s *SqlDatabase) UpdateUser(user *entity.User) error
- func (s *SqlDatabase) WaitPostMigrations() error
- type SqlRows
- type Statement
- type Stmt
- type SupportGroupRow
- type SupportGroupServiceRow
- type SupportGroupUserRow
- type Trace
- type TraceDb
- func (tdb *TraceDb) Close() error
- func (tdb *TraceDb) Exec(query string, args ...any) (sql.Result, error)
- func (tdb *TraceDb) Get(dest any, query string, args ...any) error
- func (tdb *TraceDb) GetDbInstance() *sql.DB
- func (tdb *TraceDb) PrepareNamed(query string) (NamedStmt, error)
- func (tdb *TraceDb) Preparex(query string) (Stmt, error)
- func (tdb *TraceDb) PreparexContext(ctx context.Context, query string) (Stmt, error)
- func (tdb *TraceDb) Query(query string, args ...any) (SqlRows, error)
- func (tdb *TraceDb) QueryContext(ctx context.Context, query string, args ...any) (SqlRows, error)
- func (tdb *TraceDb) QueryRow(query string, args ...any) *sql.Row
- func (tdb *TraceDb) Select(dest any, query string, args ...any) error
- type TraceNamedStmt
- type TraceSqlRows
- type TraceStmt
- type UserRow
Constants ¶
const ( FILTER_FORMAT_STR = " %s %s" OP_AND = "AND" OP_OR = "OR" ERROR_MSG_PREPARED_STMT = "Error while creating prepared statement." )
const NoUpdate = false
Property
const PostMigrationProcedureRegistryTable = "post_migration_procedure_registry"
Variables ¶
var MigrationFs fs.FS = &migrationFiles
Functions ¶
func AssociateId ¶ added in v1.63.2
func AssociateIdWithVal ¶ added in v1.63.2
func ColumnName ¶
func ColumnName(f entity.OrderByField) string
func CreateCursorParameters ¶
func CreateCursorQuery ¶
func DependentJoin ¶ added in v1.59.0
func DissociateAllIds ¶ added in v1.63.2
func DissociateId ¶ added in v1.63.2
func EncodeCursor ¶
func GetBoolValue ¶
func GetCursorQueryParameters ¶ added in v1.34.0
func GetDefaultOrder ¶
func GetDefaultOrder( order []entity.Order, by entity.OrderByField, direction entity.OrderDirection, ) []entity.Order
func GetInt16Value ¶
func GetInt64Value ¶
func GetSqlxRootConnection ¶ added in v1.24.7
func GetStringValue ¶
func GetStringValue(v sql.NullString) string
func OrderDirectionStr ¶
func OrderDirectionStr(dir entity.OrderDirection) string
func PerformExecArgs ¶ added in v1.54.0
func PerformInsertArgs ¶ added in v1.54.0
func RunMigrations ¶ added in v1.19.0
func RunMigrationsSync ¶ added in v1.24.2
func ToJsonSlice ¶ added in v1.50.0
func ToStateSlice ¶ added in v1.50.0
func ToStateSlice(in []any) []entity.StateFilterType
func ValueOrDefault ¶ added in v1.54.0
func ValueOrDefault[T any](p *T, def T) T
func WrapBuilder ¶ added in v1.50.0
WrapBuilder turns a type-specific builder function into a generic builder function
func WrapConvertRetSlice ¶ added in v1.63.0
WrapConvertRetSlice turns a type-specific accessor into a specified one
Types ¶
type BaseIssueRepositoryRow ¶
type BaseIssueRepositoryRow struct {
Id sql.NullInt64 `db:"issuerepository_id"`
Name sql.NullString `db:"issuerepository_name"`
Url sql.NullString `db:"issuerepository_url"`
CreatedAt sql.NullTime `db:"issuerepository_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"issuerepository_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"issuerepository_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"issuerepository_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"issuerepository_updated_by" json:"updated_by"`
}
func (BaseIssueRepositoryRow) AsBaseIssueRepository ¶
func (birr BaseIssueRepositoryRow) AsBaseIssueRepository() entity.BaseIssueRepository
func (BaseIssueRepositoryRow) AsIssueRepository ¶
func (birr BaseIssueRepositoryRow) AsIssueRepository() entity.IssueRepository
type BaseServiceRow ¶
type BaseServiceRow struct {
Id sql.NullInt64 `db:"service_id" json:"id"`
CCRN sql.NullString `db:"service_ccrn" json:"ccrn"`
Domain sql.NullString `db:"service_domain" json:"domain"`
Region sql.NullString `db:"service_region" json:"region"`
CreatedAt sql.NullTime `db:"service_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"service_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"service_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"service_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"service_updated_by" json:"updated_by"`
}
func (BaseServiceRow) AsBaseService ¶
func (bsr BaseServiceRow) AsBaseService() entity.BaseService
func (BaseServiceRow) AsService ¶
func (bsr BaseServiceRow) AsService() entity.Service
type ComponentInstanceRow ¶
type ComponentInstanceRow struct {
Id sql.NullInt64 `db:"componentinstance_id" json:"id"`
CCRN sql.NullString `db:"componentinstance_ccrn" json:"ccrn"`
Region sql.NullString `db:"componentinstance_region" json:"region"`
Cluster sql.NullString `db:"componentinstance_cluster" json:"cluster"`
Namespace sql.NullString `db:"componentinstance_namespace" json:"namespace"`
Domain sql.NullString `db:"componentinstance_domain" json:"domain"`
Project sql.NullString `db:"componentinstance_project" json:"project"`
Pod sql.NullString `db:"componentinstance_pod" json:"pod"`
Container sql.NullString `db:"componentinstance_container" json:"container"`
Type sql.NullString `db:"componentinstance_type" json:"type"`
ParentId sql.NullInt64 `db:"componentinstance_parent_id"`
Context sql.NullString `db:"componentinstance_context" json:"context"`
Count sql.NullInt16 `db:"componentinstance_count" json:"count"`
ComponentVersionId sql.NullInt64 `db:"componentinstance_component_version_id"`
ServiceId sql.NullInt64 `db:"componentinstance_service_id"`
CreatedAt sql.NullTime `db:"componentinstance_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"componentinstance_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"componentinstance_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"componentinstance_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"componentinstance_updated_by" json:"udpated_by"`
}
func (ComponentInstanceRow) AsComponentInstance ¶
func (cir ComponentInstanceRow) AsComponentInstance() entity.ComponentInstance
func (*ComponentInstanceRow) FromComponentInstance ¶
func (cir *ComponentInstanceRow) FromComponentInstance(ci *entity.ComponentInstance)
func (*ComponentInstanceRow) FromEntity ¶ added in v1.54.0
func (cir *ComponentInstanceRow) FromEntity(ci *entity.ComponentInstance)
func (*ComponentInstanceRow) ToEntity ¶ added in v1.54.0
func (cir *ComponentInstanceRow) ToEntity() *entity.ComponentInstance
type ComponentRow ¶
type ComponentRow struct {
Id sql.NullInt64 `db:"component_id" json:"id"`
CCRN sql.NullString `db:"component_ccrn" json:"ccrn"`
Repository sql.NullString `db:"component_repository" json:"repository"`
Organization sql.NullString `db:"component_organization" json:"organization"`
Url sql.NullString `db:"component_url" json:"url"`
Type sql.NullString `db:"component_type" json:"type"`
CreatedAt sql.NullTime `db:"component_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"component_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"component_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"component_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"component_updated_by" json:"updated_by"`
}
func (ComponentRow) AsComponent ¶
func (cr ComponentRow) AsComponent() entity.Component
func (*ComponentRow) FromComponent ¶
func (cr *ComponentRow) FromComponent(c *entity.Component)
func (*ComponentRow) FromEntity ¶ added in v1.54.0
func (cr *ComponentRow) FromEntity(c *entity.Component)
func (*ComponentRow) ToEntity ¶ added in v1.54.0
func (cr *ComponentRow) ToEntity() *entity.Component
type ComponentVersionIssueRow ¶
type ComponentVersionIssueRow struct {
ComponentVersionId sql.NullInt64 `db:"componentversionissue_component_version_id" json:"component_version_id"`
IssueId sql.NullInt64 `db:"componentversionissue_issue_id" json:"issue_id"`
CreatedAt sql.NullTime `db:"componentversionissue_created_at" json:"created_at"`
DeletedAt sql.NullTime `db:"componentversionissue_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"componentversionissue_updated_at" json:"updated_at"`
}
type ComponentVersionRow ¶
type ComponentVersionRow struct {
Id sql.NullInt64 `db:"componentversion_id" json:"id"`
Version sql.NullString `db:"componentversion_version" json:"version"`
Tag sql.NullString `db:"componentversion_tag" json:"tag"`
Repository sql.NullString `db:"componentversion_repository" json:"repository"`
Organization sql.NullString `db:"componentversion_organization" json:"organization"`
ComponentId sql.NullInt64 `db:"componentversion_component_id"`
CreatedAt sql.NullTime `db:"componentversion_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"componentversion_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"componentversion_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"componentversion_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"componentversion_updated_by" json:"updated_by"`
EndOfLife sql.NullBool `db:"componentversion_end_of_life" json:"end_of_life"`
}
func (ComponentVersionRow) AsComponentVersion ¶
func (cvr ComponentVersionRow) AsComponentVersion() entity.ComponentVersion
func (*ComponentVersionRow) FromComponentVersion ¶
func (cvr *ComponentVersionRow) FromComponentVersion(cv *entity.ComponentVersion)
func (*ComponentVersionRow) FromEntity ¶ added in v1.54.0
func (cvr *ComponentVersionRow) FromEntity(cv *entity.ComponentVersion)
func (*ComponentVersionRow) ToEntity ¶ added in v1.54.0
func (cvr *ComponentVersionRow) ToEntity() *entity.ComponentVersion
type DatabaseRow ¶
type DatabaseRow interface {
IssueRow |
IssueCountRow |
GetIssuesByRow |
IssueMatchRow |
IssueAggregationsRow |
IssueVariantRow |
BaseIssueRepositoryRow |
IssueRepositoryRow |
IssueVariantWithRepository |
ComponentRow |
ComponentInstanceRow |
ComponentVersionRow |
BaseServiceRow |
ServiceRow |
GetServicesByRow |
ServiceAggregationsRow |
UserRow |
OwnerRow |
SupportGroupRow |
SupportGroupServiceRow |
IssueRepositoryServiceRow |
ServiceIssueVariantRow |
RatingCount |
RowComposite |
PatchRow
}
type Db ¶ added in v1.17.0
type Db interface {
Close() error
Exec(query string, args ...any) (sql.Result, error)
Get(dest any, query string, args ...any) error
GetDbInstance() *sql.DB
Preparex(query string) (Stmt, error)
PreparexContext(ctx context.Context, query string) (Stmt, error)
PrepareNamed(query string) (NamedStmt, error)
Select(dest any, query string, args ...any) error
Query(query string, args ...any) (SqlRows, error)
QueryContext(ctx context.Context, query string, args ...any) (SqlRows, error)
QueryRow(query string, args ...any) *sql.Row
}
type DbObject ¶ added in v1.50.0
type DbObject[ET entity.Entity, ETFilter entity.Filter, ETResult entity.HeurekaEntity | DatabaseRow] struct { Prefix string TableName string TableKey string DefaultOrder entity.Order OrderPrefix string Properties []*Property[ET] FilterProperties []*FilterProperty[ETFilter] JoinDefs []*JoinDef[ETFilter] Attributes []Attr Aggregated bool ExtraColumnsSelector func(ETFilter, *Order) []string GetItemAppender func([]ETResult, RowComposite, []entity.Order) []ETResult GetAllCursorItemAppender func([]string, RowComposite, []entity.Order) []string ForceFrom string }
DbObject
func (*DbObject[ET, ETFilter, ETResult]) AddCursor ¶ added in v1.61.0
func (do *DbObject[ET, ETFilter, ETResult]) AddCursor(qb sq.SelectBuilder, filter entity.Filter, cursorFields []Field) sq.SelectBuilder
private TODO: fix tests and unexport
func (*DbObject[ET, ETFilter, ETResult]) AddFilter ¶ added in v1.61.0
func (do *DbObject[ET, ETFilter, ETResult]) AddFilter(qb sq.SelectBuilder, filter ETFilter) sq.SelectBuilder
private TODO: fix tests and unexport
func (*DbObject[ET, ETFilter, ETResult]) AddJoins ¶ added in v1.61.0
func (do *DbObject[ET, ETFilter, ETResult]) AddJoins(qb sq.SelectBuilder, filter ETFilter, order *Order) sq.SelectBuilder
private TODO: fix tests and unexport
func (*DbObject[ET, ETFilter, ETResult]) GetAllCursors ¶ added in v1.63.1
func (do *DbObject[ET, ETFilter, ETResult]) GetAllCursors(ctx context.Context, db Db, filter ETFilter, order []entity.Order) ([]string, error)
TODO: The only difference between Get/GetAllCursors is withCursor(false/true), logging and picked Appender (Extract Method)
func (*DbObject[ET, ETFilter, ETResult]) GetFilterParameters_tmp ¶ added in v1.61.0
func (*DbObject[ET, ETFilter, ETResult]) GetFilterQuery_tmp ¶ added in v1.61.0
func (*DbObject[ET, ETFilter, ETResult]) GetFilterWhereClause_tmp ¶ added in v1.61.0
func (*DbObject[ET, ETFilter, ETResult]) GetJoins_tmp ¶ added in v1.61.0
DEPRECATED: TODO: remove
func (*DbObject[ET, ETFilter, ETResult]) InsertQuery ¶ added in v1.50.0
private TODO: Fix testing and unexport
type Field ¶
type Field struct {
Name entity.OrderByField
Value any
Order entity.OrderDirection
}
func DecodeCursor ¶
type FilterProperty ¶ added in v1.50.0
type FilterProperty[T any] struct { BuildQuery func([]any) string GetParam func(T) []any BuildParams func(T) []any }
FilterProperty
func NewCustomFilterProperty ¶ added in v1.50.0
func NewCustomFilterProperty[T any]( buildQuery func([]any) string, getParam func(T) any, ) *FilterProperty[T]
func NewFilterProperty ¶ added in v1.50.0
func NewFilterProperty[T any](query string, param func(T) any) *FilterProperty[T]
func NewJsonFilterProperty ¶ added in v1.50.0
func NewJsonFilterProperty[T any](query string, param func(T) any) *FilterProperty[T]
func NewNFilterProperty ¶ added in v1.50.0
func NewNFilterProperty[T any](query string, param func(T) any, nparam int) *FilterProperty[T]
func NewStateFilterProperty ¶ added in v1.50.0
func NewStateFilterProperty[T any]( prefix string, param func(T) any, ) *FilterProperty[T]
func (FilterProperty[T]) GetParameters ¶ added in v1.61.0
func (fp FilterProperty[T]) GetParameters(filter T) []any
func (FilterProperty[T]) GetQuery ¶ added in v1.50.0
func (fp FilterProperty[T]) GetQuery(filter T) string
type GetIssuesByRow ¶
type GetIssuesByRow struct {
IssueAggregationsRow
IssueRow
}
func (GetIssuesByRow) AsIssue ¶
func (ibr GetIssuesByRow) AsIssue() entity.Issue
func (GetIssuesByRow) AsIssueWithAggregations ¶
func (ibr GetIssuesByRow) AsIssueWithAggregations() entity.IssueWithAggregations
type GetServicesByRow ¶
type GetServicesByRow struct {
ServiceAggregationsRow
ServiceRow
}
func (GetServicesByRow) AsServiceWithAggregations ¶
func (sbr GetServicesByRow) AsServiceWithAggregations() entity.ServiceWithAggregations
type IssueAggregationsRow ¶
type IssueAggregationsRow struct {
IssueMatches sql.NullInt64 `db:"agg_issue_matches"`
AffectedServices sql.NullInt64 `db:"agg_affected_services"`
ComponentVersions sql.NullInt64 `db:"agg_component_versions"`
AffectedComponentInstances sql.NullInt64 `db:"agg_affected_component_instances"`
EarliestTargetRemediationDate sql.NullTime `db:"agg_earliest_target_remediation_date"`
EarliestDiscoveryDate sql.NullTime `db:"agg_earliest_discovery_date"`
}
type IssueCountRow ¶
type IssueCountRow struct {
Count sql.NullInt64 `db:"issue_count"`
Value sql.NullString `db:"issue_value"`
}
func (IssueCountRow) AsIssueCount ¶
func (icr IssueCountRow) AsIssueCount() entity.IssueCount
type IssueMatchRow ¶
type IssueMatchRow struct {
Id sql.NullInt64 `db:"issuematch_id" json:"id"`
Status sql.NullString `db:"issuematch_status" json:"status"`
Vector sql.NullString `db:"issuematch_vector" json:"vector"`
Rating sql.NullString `db:"issuematch_rating" json:"rating"`
UserId sql.NullInt64 `db:"issuematch_user_id" json:"user_id"`
ComponentInstanceId sql.NullInt64 `db:"issuematch_component_instance_id" json:"component_instance_id"`
IssueId sql.NullInt64 `db:"issuematch_issue_id" json:"issue_id"`
RemediationDate sql.NullTime `db:"issuematch_remediation_date" json:"remediation_date"`
TargetRemediationDate sql.NullTime `db:"issuematch_target_remediation_date" json:"target_remediation_date"`
CreatedAt sql.NullTime `db:"issuematch_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"issuematch_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"issuematch_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"issuematch_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"issuematch_updated_by" json:"updated_by"`
}
func (IssueMatchRow) AsIssueMatch ¶
func (imr IssueMatchRow) AsIssueMatch() entity.IssueMatch
func (*IssueMatchRow) FromEntity ¶ added in v1.54.0
func (imr *IssueMatchRow) FromEntity(im *entity.IssueMatch)
func (*IssueMatchRow) FromIssueMatch ¶
func (imr *IssueMatchRow) FromIssueMatch(im *entity.IssueMatch)
func (*IssueMatchRow) ToEntity ¶ added in v1.54.0
func (imr *IssueMatchRow) ToEntity() *entity.IssueMatch
type IssueRepositoryRow ¶
type IssueRepositoryRow struct {
BaseIssueRepositoryRow
IssueRepositoryServiceRow
}
func (IssueRepositoryRow) AsIssueRepository ¶
func (irr IssueRepositoryRow) AsIssueRepository() entity.IssueRepository
func (*IssueRepositoryRow) FromEntity ¶ added in v1.54.0
func (irr *IssueRepositoryRow) FromEntity(ir *entity.IssueRepository)
func (*IssueRepositoryRow) FromIssueRepository ¶
func (irr *IssueRepositoryRow) FromIssueRepository(ir *entity.IssueRepository)
func (*IssueRepositoryRow) ToEntity ¶ added in v1.54.0
func (irr *IssueRepositoryRow) ToEntity() *entity.IssueRepository
type IssueRepositoryServiceRow ¶
type IssueRepositoryServiceRow struct {
IssueRepositoryId sql.NullInt64 `db:"issuerepositoryservice_issue_repository_id" json:"issue_repository_id"`
ServiceId sql.NullInt64 `db:"issuerepositoryservice_service_id" json:"service_id"`
Priority sql.NullInt64 `db:"issuerepositoryservice_priority" json:"priority"`
CreatedAt sql.NullTime `db:"issuerepositoryservice_created_at" json:"created_at"`
DeletedAt sql.NullTime `db:"issuerepositoryservice_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"issuerepositoryservice_updated_at" json:"updated_at"`
}
type IssueRow ¶
type IssueRow struct {
Id sql.NullInt64 `db:"issue_id" json:"id"`
Type sql.NullString `db:"issue_type" json:"type"`
PrimaryName sql.NullString `db:"issue_primary_name" json:"primary_name"`
Description sql.NullString `db:"issue_description" json:"description"`
CreatedAt sql.NullTime `db:"issue_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"issue_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"issue_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"issue_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"issue_updated_by" json:"updated_by"`
}
func (*IssueRow) FromEntity ¶ added in v1.54.0
type IssueVariantRow ¶
type IssueVariantRow struct {
Id sql.NullInt64 `db:"issuevariant_id" json:"id"`
IssueId sql.NullInt64 `db:"issuevariant_issue_id" json:"issue_id"`
IssueRepositoryId sql.NullInt64 `db:"issuevariant_repository_id" json:"issue_repository_id"`
SecondaryName sql.NullString `db:"issuevariant_secondary_name" json:"secondary_name"`
Vector sql.NullString `db:"issuevariant_vector" json:"vector"`
Rating sql.NullString `db:"issuevariant_rating" json:"rating"`
RatingNumerical sql.NullInt64 `db:"issuevariant_rating_num" json:"rating_numerical"`
Description sql.NullString `db:"issuevariant_description" json:"description"`
ExternalUrl sql.NullString `db:"issuevariant_external_url" json:"external_url"`
CreatedAt sql.NullTime `db:"issuevariant_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"issuevariant_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"issuevariant_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"issuevariant_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"issuevariant_updated_by" json:"updated_by"`
}
func (IssueVariantRow) AsIssueVariant ¶
func (ivr IssueVariantRow) AsIssueVariant() entity.IssueVariant
func (*IssueVariantRow) FromEntity ¶ added in v1.54.0
func (ivr *IssueVariantRow) FromEntity(iv *entity.IssueVariant)
func (*IssueVariantRow) FromIssueVariant ¶
func (ivr *IssueVariantRow) FromIssueVariant(iv *entity.IssueVariant)
func (*IssueVariantRow) ToEntity ¶ added in v1.54.0
func (ivr *IssueVariantRow) ToEntity() *entity.IssueVariant
type IssueVariantWithRepository ¶
type IssueVariantWithRepository struct {
IssueRepositoryRow
IssueVariantRow
}
func (*IssueVariantWithRepository) AsIssueVariantEntry ¶
func (ivwr *IssueVariantWithRepository) AsIssueVariantEntry() entity.IssueVariant
type JoinResolver ¶ added in v1.59.0
type JoinResolver[T any] struct { // contains filtered or unexported fields }
func NewJoinResolver ¶ added in v1.59.0
func NewJoinResolver[T any](defs []*JoinDef[T]) *JoinResolver[T]
func (*JoinResolver[T]) Build ¶ added in v1.59.0
func (jr *JoinResolver[T]) Build(filter T, order *Order) []string
func (*JoinResolver[T]) Build_tmp ¶ added in v1.61.0
func (jr *JoinResolver[T]) Build_tmp(filter T, order *Order) string
type NewCursor ¶
type NewCursor func(cursors *cursors) error
func WithComponent ¶ added in v1.18.0
func WithComponentInstance ¶
func WithComponentInstance(order []entity.Order, ci entity.ComponentInstance) NewCursor
func WithComponentVersion ¶
func WithComponentVersion( order []entity.Order, cv entity.ComponentVersion, isc entity.IssueSeverityCounts, ) NewCursor
func WithIssueMatch ¶
func WithIssueMatch(order []entity.Order, im entity.IssueMatch) NewCursor
func WithIssueRepository ¶ added in v1.50.0
func WithIssueRepository(order []entity.Order, r entity.IssueRepository) NewCursor
func WithIssueVariant ¶ added in v1.50.0
func WithIssueVariant(order []entity.Order, r entity.IssueVariant) NewCursor
func WithRemediation ¶ added in v1.25.0
func WithRemediation(order []entity.Order, r entity.Remediation) NewCursor
func WithService ¶
func WithServiceIssueVariant ¶ added in v1.50.0
func WithServiceIssueVariant(order []entity.Order, r entity.ServiceIssueVariant) NewCursor
func WithSupportGroup ¶ added in v1.13.0
func WithSupportGroup(order []entity.Order, sg entity.SupportGroup) NewCursor
type Object ¶ added in v1.60.3
type Object[T entity.Filter] interface { AddJoins(sq.SelectBuilder, T, *Order) sq.SelectBuilder AddFilter(sq.SelectBuilder, T) sq.SelectBuilder AddCursor(sq.SelectBuilder, entity.Filter, []Field) sq.SelectBuilder }
TODO remove
type Order ¶ added in v1.60.0
type Order struct {
// contains filtered or unexported fields
}
func NewOrderWithCounterPrefix ¶ added in v1.60.5
func (Order) ByIssuePrimaryName ¶ added in v1.60.0
func (Order) ToSqlWithPrefixAll ¶ added in v1.61.0
TODO: remove it when GetServicesWithAggregations will use DbObject
type OwnerRow ¶
type OwnerRow struct {
ServiceId sql.NullInt64 `db:"owner_service_id" json:"service_id"`
UserId sql.NullInt64 `db:"owner_user_id" json:"user_id"`
CreatedAt sql.NullTime `db:"owner_created_at" json:"created_at"`
DeletedAt sql.NullTime `db:"owner_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"owner_updated_at" json:"updated_at"`
}
type PatchRow ¶ added in v1.34.0
type PatchRow struct {
Id sql.NullInt64 `db:"patch_id" json:"id"`
ServiceId sql.NullInt64 `db:"patch_service_id" json:"service_id"`
ServiceName sql.NullString `db:"patch_service_name" json:"service_name"`
ComponentVersionId sql.NullInt64 `db:"patch_component_version_id" json:"compoidnent_version_id"`
ComponentVersionName sql.NullString `db:"patch_component_version_name" json:"compoidnent_version_name"`
CreatedAt sql.NullTime `db:"patch_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"patch_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"patch_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"patch_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"patch_updated_by" json:"Updated_by"`
}
func (*PatchRow) FromEntity ¶ added in v1.54.0
type Property ¶ added in v1.50.0
func NewProperty ¶ added in v1.50.0
func (Property[T]) GetUpdateData ¶ added in v1.54.0
type QuietDb ¶ added in v1.17.0
type QuietDb struct {
// contains filtered or unexported fields
}
func (*QuietDb) GetDbInstance ¶ added in v1.17.0
func (*QuietDb) PrepareNamed ¶ added in v1.17.0
func (*QuietDb) PreparexContext ¶ added in v1.60.1
func (*QuietDb) QueryContext ¶ added in v1.60.1
type RatingCount ¶
type RatingCount struct {
Critical sql.NullInt64 `db:"critical_count"`
High sql.NullInt64 `db:"high_count"`
Medium sql.NullInt64 `db:"medium_count"`
Low sql.NullInt64 `db:"low_count"`
None sql.NullInt64 `db:"none_count"`
}
func (*RatingCount) AsIssueSeverityCounts ¶
func (rc *RatingCount) AsIssueSeverityCounts() entity.IssueSeverityCounts
type RemediationRow ¶ added in v1.25.0
type RemediationRow struct {
Id sql.NullInt64 `db:"remediation_id" json:"id"`
Type sql.NullString `db:"remediation_type" json:"type"`
URL sql.NullString `db:"remediation_url" json:"url"`
Description sql.NullString `db:"remediation_description" json:"description"`
RemediationDate sql.NullTime `db:"remediation_remediation_date" json:"remediation_date"`
ExpirationDate sql.NullTime `db:"remediation_expiration_date" json:"expiry_date"`
Severity sql.NullString `db:"remediation_severity" json:"severity"`
RemediatedBy sql.NullString `db:"remediation_remediated_by" json:"remediated_by"`
RemediatedById sql.NullInt64 `db:"remediation_remediated_by_id" json:"remediated_by_id"`
Service sql.NullString `db:"remediation_service" json:"service"`
ServiceId sql.NullInt64 `db:"remediation_service_id" json:"service_id"`
Component sql.NullString `db:"remediation_component" json:"component"`
ComponentId sql.NullInt64 `db:"remediation_component_id" json:"component_id"`
Issue sql.NullString `db:"remediation_issue" json:"issue"`
IssueId sql.NullInt64 `db:"remediation_issue_id" json:"issue_id"`
CreatedAt sql.NullTime `db:"remediation_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"remediation_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"remediation_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"remediation_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"remediation_updated_by" json:"updated_by"`
}
func (RemediationRow) AsRemediation ¶ added in v1.25.0
func (rr RemediationRow) AsRemediation() entity.Remediation
func (*RemediationRow) FromEntity ¶ added in v1.54.0
func (rr *RemediationRow) FromEntity(r *entity.Remediation)
func (*RemediationRow) FromRemediation ¶ added in v1.25.0
func (rr *RemediationRow) FromRemediation(r *entity.Remediation)
func (*RemediationRow) ToEntity ¶ added in v1.54.0
func (rr *RemediationRow) ToEntity() *entity.Remediation
type RowComposite ¶
type RowComposite struct {
*IssueRow
*IssueCountRow
*GetIssuesByRow
*IssueMatchRow
*IssueAggregationsRow
*IssueVariantRow
*BaseIssueRepositoryRow
*IssueRepositoryRow
*IssueVariantWithRepository
*ComponentRow
*ComponentInstanceRow
*ComponentVersionRow
*BaseServiceRow
*ServiceRow
*GetServicesByRow
*ServiceAggregationsRow
*UserRow
*OwnerRow
*SupportGroupRow
*SupportGroupServiceRow
*IssueRepositoryServiceRow
*ServiceIssueVariantRow
*RatingCount
*RemediationRow
*PatchRow
}
RowComposite is a composite type that contains all the row types for the database This is used to unmarshal the database rows into the corresponding entity types in a dynamical manner
type ScannerRunRow ¶
type ScannerRunRow struct {
RunID sql.NullInt64 `db:"scannerrun_run_id"`
UUID sql.NullString `db:"scannerrun_uuid"`
Tag sql.NullString `db:"scannerrun_tag"`
StartRun sql.NullTime `db:"scannerrun_start_run"`
EndRun sql.NullTime `db:"scannerrun_end_run"`
IsCompleted sql.NullBool `db:"scannerrun_is_completed"`
CreatedAt sql.NullTime `db:"scannerrun_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"scannerrun_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"scannerrun_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"scannerrun_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"scannerrun_updated_by" json:"updated_by"`
}
func (ScannerRunRow) AsScannerRun ¶
func (srr ScannerRunRow) AsScannerRun() entity.ScannerRun
func (*ScannerRunRow) FromScannerRun ¶
func (srr *ScannerRunRow) FromScannerRun(sr *entity.ScannerRun)
type ServiceAggregationsRow ¶
type ServiceAggregationsRow struct {
ComponentInstances sql.NullInt64 `db:"service_agg_component_instances"`
IssueMatches sql.NullInt64 `db:"service_agg_issue_matches"`
}
func (ServiceAggregationsRow) AsServiceAggregations ¶
func (sar ServiceAggregationsRow) AsServiceAggregations() entity.ServiceAggregations
type ServiceIssueVariantRow ¶
type ServiceIssueVariantRow struct {
IssueRepositoryRow
IssueVariantRow
}
func (ServiceIssueVariantRow) AsServiceIssueVariantEntry ¶
func (sivr ServiceIssueVariantRow) AsServiceIssueVariantEntry() entity.ServiceIssueVariant
func (*ServiceIssueVariantRow) FromEntity ¶ added in v1.54.0
func (sivr *ServiceIssueVariantRow) FromEntity(siv *entity.ServiceIssueVariant)
func (*ServiceIssueVariantRow) ToEntity ¶ added in v1.54.0
func (sivr *ServiceIssueVariantRow) ToEntity() *entity.ServiceIssueVariant
type ServiceRow ¶
type ServiceRow struct {
BaseServiceRow
IssueRepositoryServiceRow
}
func (ServiceRow) AsService ¶
func (sr ServiceRow) AsService() entity.Service
func (*ServiceRow) FromEntity ¶ added in v1.54.0
func (sr *ServiceRow) FromEntity(s *entity.Service)
func (*ServiceRow) FromService ¶
func (sr *ServiceRow) FromService(s *entity.Service)
func (*ServiceRow) ToEntity ¶ added in v1.54.0
func (sr *ServiceRow) ToEntity() *entity.Service
type SqlDatabase ¶
type SqlDatabase struct {
// contains filtered or unexported fields
}
func NewSqlDatabase ¶
func NewSqlDatabase(cfg util.Config) (*SqlDatabase, error)
func (*SqlDatabase) AddComponentVersionToIssue ¶
func (s *SqlDatabase) AddComponentVersionToIssue(issueId int64, componentVersionId int64) error
func (*SqlDatabase) AddIssueRepositoryToService ¶
func (s *SqlDatabase) AddIssueRepositoryToService(serviceId int64, issueRepositoryId int64, priority int64) error
func (*SqlDatabase) AddOwnerToService ¶
func (s *SqlDatabase) AddOwnerToService(serviceId int64, userId int64) error
func (*SqlDatabase) AddServiceToSupportGroup ¶
func (s *SqlDatabase) AddServiceToSupportGroup(supportGroupId int64, serviceId int64) error
func (*SqlDatabase) AddUserToSupportGroup ¶
func (s *SqlDatabase) AddUserToSupportGroup(supportGroupId int64, userId int64) error
func (*SqlDatabase) Autopatch ¶ added in v1.34.0
func (s *SqlDatabase) Autopatch(ctx context.Context) (bool, error)
func (*SqlDatabase) CloseConnection ¶
func (s *SqlDatabase) CloseConnection() error
func (*SqlDatabase) CompleteScannerRun ¶
func (s *SqlDatabase) CompleteScannerRun(uuid string) (bool, error)
func (*SqlDatabase) ConnectDB ¶
func (s *SqlDatabase) ConnectDB(dbName string) error
func (*SqlDatabase) CountComponentInstances ¶
func (s *SqlDatabase) CountComponentInstances(ctx context.Context, filter *entity.ComponentInstanceFilter) (int64, error)
func (*SqlDatabase) CountComponentVersions ¶
func (s *SqlDatabase) CountComponentVersions(ctx context.Context, filter *entity.ComponentVersionFilter) (int64, error)
func (*SqlDatabase) CountComponentVulnerabilities ¶ added in v1.18.0
func (s *SqlDatabase) CountComponentVulnerabilities( ctx context.Context, filter *entity.ComponentFilter, ) ([]entity.IssueSeverityCounts, error)
TODO use DbObject
func (*SqlDatabase) CountComponents ¶
func (s *SqlDatabase) CountComponents(ctx context.Context, filter *entity.ComponentFilter) (int64, error)
func (*SqlDatabase) CountIssueMatches ¶
func (s *SqlDatabase) CountIssueMatches(ctx context.Context, filter *entity.IssueMatchFilter) (int64, error)
func (*SqlDatabase) CountIssueRatings ¶
func (s *SqlDatabase) CountIssueRatings( ctx context.Context, filter *entity.IssueFilter, ) (*entity.IssueSeverityCounts, error)
func (*SqlDatabase) CountIssueRepositories ¶
func (s *SqlDatabase) CountIssueRepositories(ctx context.Context, filter *entity.IssueRepositoryFilter) (int64, error)
func (*SqlDatabase) CountIssueTypes ¶
func (s *SqlDatabase) CountIssueTypes(ctx context.Context, filter *entity.IssueFilter) (*entity.IssueTypeCounts, error)
func (*SqlDatabase) CountIssueVariants ¶
func (s *SqlDatabase) CountIssueVariants(ctx context.Context, filter *entity.IssueVariantFilter) (int64, error)
func (*SqlDatabase) CountIssues ¶
func (s *SqlDatabase) CountIssues(ctx context.Context, filter *entity.IssueFilter) (int64, error)
func (*SqlDatabase) CountPatches ¶ added in v1.34.0
func (s *SqlDatabase) CountPatches(ctx context.Context, filter *entity.PatchFilter) (int64, error)
func (*SqlDatabase) CountRemediations ¶ added in v1.25.0
func (s *SqlDatabase) CountRemediations(ctx context.Context, filter *entity.RemediationFilter) (int64, error)
func (*SqlDatabase) CountScannerRuns ¶
func (s *SqlDatabase) CountScannerRuns(filter *entity.ScannerRunFilter) (int, error)
func (*SqlDatabase) CountServices ¶
func (s *SqlDatabase) CountServices(ctx context.Context, filter *entity.ServiceFilter) (int64, error)
func (*SqlDatabase) CountSupportGroups ¶
func (s *SqlDatabase) CountSupportGroups(ctx context.Context, filter *entity.SupportGroupFilter) (int64, error)
func (*SqlDatabase) CountUsers ¶
func (s *SqlDatabase) CountUsers(ctx context.Context, filter *entity.UserFilter) (int64, error)
func (*SqlDatabase) CreateComponent ¶
func (*SqlDatabase) CreateComponentInstance ¶
func (s *SqlDatabase) CreateComponentInstance(componentInstance *entity.ComponentInstance) (*entity.ComponentInstance, error)
func (*SqlDatabase) CreateComponentVersion ¶
func (s *SqlDatabase) CreateComponentVersion( componentVersion *entity.ComponentVersion, ) (*entity.ComponentVersion, error)
func (*SqlDatabase) CreateIssue ¶
func (*SqlDatabase) CreateIssueMatch ¶
func (s *SqlDatabase) CreateIssueMatch(issueMatch *entity.IssueMatch) (*entity.IssueMatch, error)
func (*SqlDatabase) CreateIssueRepository ¶
func (s *SqlDatabase) CreateIssueRepository( issueRepository *entity.IssueRepository, ) (*entity.IssueRepository, error)
func (*SqlDatabase) CreateIssueVariant ¶
func (s *SqlDatabase) CreateIssueVariant( issueVariant *entity.IssueVariant, ) (*entity.IssueVariant, error)
func (*SqlDatabase) CreateRemediation ¶ added in v1.25.0
func (s *SqlDatabase) CreateRemediation( remediation *entity.Remediation, ) (*entity.Remediation, error)
func (*SqlDatabase) CreateScannerRun ¶
func (s *SqlDatabase) CreateScannerRun(scannerRun *entity.ScannerRun) (bool, error)
func (*SqlDatabase) CreateScannerRunComponentInstanceTracker ¶
func (s *SqlDatabase) CreateScannerRunComponentInstanceTracker( componentInstanceId int64, scannerRunUUID string, ) error
func (*SqlDatabase) CreateService ¶
func (*SqlDatabase) CreateSupportGroup ¶
func (s *SqlDatabase) CreateSupportGroup(supportGroup *entity.SupportGroup) (*entity.SupportGroup, error)
func (*SqlDatabase) CreateUser ¶
func (*SqlDatabase) DeleteComponent ¶
func (s *SqlDatabase) DeleteComponent(id int64, userId int64) error
func (*SqlDatabase) DeleteComponentInstance ¶
func (s *SqlDatabase) DeleteComponentInstance(id int64, userId int64) error
func (*SqlDatabase) DeleteComponentVersion ¶
func (s *SqlDatabase) DeleteComponentVersion(id int64, userId int64) error
func (*SqlDatabase) DeleteIssue ¶
func (s *SqlDatabase) DeleteIssue(id int64, userId int64) error
func (*SqlDatabase) DeleteIssueMatch ¶
func (s *SqlDatabase) DeleteIssueMatch(id int64, userId int64) error
func (*SqlDatabase) DeleteIssueRepository ¶
func (s *SqlDatabase) DeleteIssueRepository(id int64, userId int64) error
func (*SqlDatabase) DeleteIssueVariant ¶
func (s *SqlDatabase) DeleteIssueVariant(id int64, userId int64) error
func (*SqlDatabase) DeleteRemediation ¶ added in v1.25.0
func (s *SqlDatabase) DeleteRemediation(id int64, userId int64) error
func (*SqlDatabase) DeleteService ¶
func (s *SqlDatabase) DeleteService(id int64, userId int64) error
func (*SqlDatabase) DeleteSupportGroup ¶
func (s *SqlDatabase) DeleteSupportGroup(id int64, userId int64) error
func (*SqlDatabase) DeleteUser ¶
func (s *SqlDatabase) DeleteUser(id int64, userId int64) error
func (*SqlDatabase) DropSchema ¶
func (s *SqlDatabase) DropSchema(name string) error
func (*SqlDatabase) FailScannerRun ¶
func (s *SqlDatabase) FailScannerRun(uuid string, message string) (bool, error)
func (*SqlDatabase) GetAllComponentCursors ¶ added in v1.18.0
func (s *SqlDatabase) GetAllComponentCursors(ctx context.Context, filter *entity.ComponentFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllComponentInstanceCursors ¶
func (s *SqlDatabase) GetAllComponentInstanceCursors(ctx context.Context, filter *entity.ComponentInstanceFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllComponentVersionCursors ¶
func (s *SqlDatabase) GetAllComponentVersionCursors( ctx context.Context, filter *entity.ComponentVersionFilter, order []entity.Order, ) ([]string, error)
func (*SqlDatabase) GetAllIssueCursors ¶
func (s *SqlDatabase) GetAllIssueCursors(ctx context.Context, filter *entity.IssueFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllIssueMatchCursors ¶
func (s *SqlDatabase) GetAllIssueMatchCursors(ctx context.Context, filter *entity.IssueMatchFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllIssueMatchIds ¶
func (s *SqlDatabase) GetAllIssueMatchIds(ctx context.Context, filter *entity.IssueMatchFilter) ([]int64, error)
func (*SqlDatabase) GetAllIssueRepositoryCursors ¶ added in v1.50.0
func (s *SqlDatabase) GetAllIssueRepositoryCursors( ctx context.Context, filter *entity.IssueRepositoryFilter, order []entity.Order, ) ([]string, error)
func (*SqlDatabase) GetAllIssueVariantCursors ¶ added in v1.50.0
func (s *SqlDatabase) GetAllIssueVariantCursors( ctx context.Context, filter *entity.IssueVariantFilter, order []entity.Order, ) ([]string, error)
func (*SqlDatabase) GetAllPatchCursors ¶ added in v1.34.0
func (s *SqlDatabase) GetAllPatchCursors( ctx context.Context, filter *entity.PatchFilter, order []entity.Order, ) ([]string, error)
func (*SqlDatabase) GetAllRemediationCursors ¶ added in v1.25.0
func (s *SqlDatabase) GetAllRemediationCursors( ctx context.Context, filter *entity.RemediationFilter, order []entity.Order, ) ([]string, error)
func (*SqlDatabase) GetAllServiceCursors ¶
func (s *SqlDatabase) GetAllServiceCursors(ctx context.Context, filter *entity.ServiceFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllSupportGroupCursors ¶ added in v1.13.0
func (s *SqlDatabase) GetAllSupportGroupCursors(ctx context.Context, filter *entity.SupportGroupFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllUserCursors ¶ added in v1.50.0
func (s *SqlDatabase) GetAllUserCursors(ctx context.Context, filter *entity.UserFilter, order []entity.Order) ([]string, error)
func (*SqlDatabase) GetAllUserIds ¶
func (s *SqlDatabase) GetAllUserIds(ctx context.Context, filter *entity.UserFilter) ([]int64, error)
func (*SqlDatabase) GetCcrn ¶
func (s *SqlDatabase) GetCcrn(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetCluster ¶
func (s *SqlDatabase) GetCluster(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetComponentCcrns ¶
func (s *SqlDatabase) GetComponentCcrns(ctx context.Context, filter *entity.ComponentFilter) ([]string, error)
func (*SqlDatabase) GetComponentInstanceParent ¶ added in v1.1.0
func (s *SqlDatabase) GetComponentInstanceParent(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetComponentInstances ¶
func (s *SqlDatabase) GetComponentInstances(ctx context.Context, filter *entity.ComponentInstanceFilter, order []entity.Order) ([]entity.ComponentInstanceResult, error)
func (*SqlDatabase) GetComponentVersions ¶
func (s *SqlDatabase) GetComponentVersions( ctx context.Context, filter *entity.ComponentVersionFilter, order []entity.Order, ) ([]entity.ComponentVersionResult, error)
func (*SqlDatabase) GetComponents ¶
func (s *SqlDatabase) GetComponents(ctx context.Context, filter *entity.ComponentFilter, order []entity.Order) ([]entity.ComponentResult, error)
func (*SqlDatabase) GetContainer ¶
func (s *SqlDatabase) GetContainer(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetContext ¶
func (s *SqlDatabase) GetContext(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetDefaultIssuePriority ¶
func (s *SqlDatabase) GetDefaultIssuePriority() int64
GetDefaultIssuePriority ...
func (*SqlDatabase) GetDefaultRepositoryName ¶
func (s *SqlDatabase) GetDefaultRepositoryName() string
func (*SqlDatabase) GetDomain ¶
func (s *SqlDatabase) GetDomain(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetEarliestRemediationByIssueIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetEarliestRemediationByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]time.Time, error)
GetEarliestRemediationByIssueIDs returns the earliest target remediation date per issue.
func (*SqlDatabase) GetIssueCountsByComponentIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetIssueCountsByComponentIDs(ctx context.Context, componentIDs []int64, serviceCCRN []*string) (map[int64]entity.IssueSeverityCounts, error)
GetIssueCountsByComponentIDs returns issue severity counts grouped by component ID in a single query. This eliminates N+1 queries when loading vulnerability counts for multiple images. The optional serviceCCRN filter restricts counts to the specified services.
func (*SqlDatabase) GetIssueCountsByServiceIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetIssueCountsByServiceIDs(ctx context.Context, serviceIDs []int64) (map[int64]entity.IssueSeverityCounts, error)
GetIssueCountsByServiceIDs returns issue severity counts grouped by service ID in a single query. This eliminates N+1 queries when loading issue counts for multiple services.
func (*SqlDatabase) GetIssueMatches ¶
func (s *SqlDatabase) GetIssueMatches(ctx context.Context, filter *entity.IssueMatchFilter, order []entity.Order) ([]entity.IssueMatchResult, error)
func (*SqlDatabase) GetIssueNames ¶
func (s *SqlDatabase) GetIssueNames(ctx context.Context, filter *entity.IssueFilter) ([]string, error)
func (*SqlDatabase) GetIssueRepositories ¶
func (s *SqlDatabase) GetIssueRepositories( ctx context.Context, filter *entity.IssueRepositoryFilter, order []entity.Order, ) ([]entity.IssueRepositoryResult, error)
func (*SqlDatabase) GetIssueVariants ¶
func (s *SqlDatabase) GetIssueVariants( ctx context.Context, filter *entity.IssueVariantFilter, order []entity.Order, ) ([]entity.IssueVariantResult, error)
func (*SqlDatabase) GetIssues ¶
func (s *SqlDatabase) GetIssues(ctx context.Context, filter *entity.IssueFilter, order []entity.Order) ([]entity.IssueResult, error)
func (*SqlDatabase) GetIssuesWithAggregations ¶
func (s *SqlDatabase) GetIssuesWithAggregations(ctx context.Context, filter *entity.IssueFilter, order []entity.Order) ([]entity.IssueResult, error)
TODO: use DbObject
func (*SqlDatabase) GetMaxSeverityByIssueIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetMaxSeverityByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]string, error)
GetMaxSeverityByIssueIDs returns the highest severity rating per issue in a single aggregate query. It queries IssueMatch grouped by issue_id and picks the max rating using the ENUM ordering (Critical > High > Medium > Low > None).
func (*SqlDatabase) GetNamespace ¶
func (s *SqlDatabase) GetNamespace(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetOwnersByServiceIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetOwnersByServiceIDs(ctx context.Context, serviceIDs []int64) (map[int64][]entity.User, error)
GetOwnersByServiceIDs returns owners (users) grouped by service ID in a single query. This eliminates N+1 queries when loading owners for multiple services.
func (*SqlDatabase) GetPatches ¶ added in v1.34.0
func (s *SqlDatabase) GetPatches( ctx context.Context, filter *entity.PatchFilter, order []entity.Order, ) ([]entity.PatchResult, error)
func (*SqlDatabase) GetPod ¶
func (s *SqlDatabase) GetPod(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetProject ¶
func (s *SqlDatabase) GetProject(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetRegion ¶
func (s *SqlDatabase) GetRegion(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetRemediations ¶ added in v1.25.0
func (s *SqlDatabase) GetRemediations( ctx context.Context, filter *entity.RemediationFilter, order []entity.Order, ) ([]entity.RemediationResult, error)
func (*SqlDatabase) GetScannerRunTags ¶
func (s *SqlDatabase) GetScannerRunTags() ([]string, error)
func (*SqlDatabase) GetScannerRuns ¶
func (s *SqlDatabase) GetScannerRuns(filter *entity.ScannerRunFilter) ([]entity.ScannerRun, error)
func (*SqlDatabase) GetServiceCcrns ¶
func (s *SqlDatabase) GetServiceCcrns(ctx context.Context, filter *entity.ServiceFilter) ([]string, error)
func (*SqlDatabase) GetServiceDomains ¶ added in v1.23.0
func (s *SqlDatabase) GetServiceDomains(ctx context.Context, filter *entity.ServiceFilter) ([]string, error)
func (*SqlDatabase) GetServiceIssueVariants ¶
func (s *SqlDatabase) GetServiceIssueVariants( ctx context.Context, filter *entity.ServiceIssueVariantFilter, order []entity.Order, ) ([]entity.ServiceIssueVariantResult, error)
func (*SqlDatabase) GetServiceRegions ¶ added in v1.23.0
func (s *SqlDatabase) GetServiceRegions(ctx context.Context, filter *entity.ServiceFilter) ([]string, error)
func (*SqlDatabase) GetServices ¶
func (s *SqlDatabase) GetServices(ctx context.Context, filter *entity.ServiceFilter, order []entity.Order) ([]entity.ServiceResult, error)
func (*SqlDatabase) GetServicesByIssueIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetServicesByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64][]entity.ServiceResult, error)
GetServicesByIssueIDs returns services grouped by issue ID. Join path: IssueMatch -> ComponentInstance -> Service
func (*SqlDatabase) GetServicesWithAggregations ¶
func (s *SqlDatabase) GetServicesWithAggregations( ctx context.Context, filter *entity.ServiceFilter, order []entity.Order, ) ([]entity.ServiceResult, error)
TODO use DbObject
func (*SqlDatabase) GetSourceURLsByIssueIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetSourceURLsByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]string, error)
GetSourceURLsByIssueIDs returns one source URL (external URL from the first IssueVariant) per issue.
func (*SqlDatabase) GetSupportGroupCcrns ¶
func (s *SqlDatabase) GetSupportGroupCcrns(ctx context.Context, filter *entity.SupportGroupFilter) ([]string, error)
func (*SqlDatabase) GetSupportGroups ¶
func (s *SqlDatabase) GetSupportGroups(ctx context.Context, filter *entity.SupportGroupFilter, order []entity.Order) ([]entity.SupportGroupResult, error)
func (*SqlDatabase) GetSupportGroupsByIssueIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetSupportGroupsByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64][]entity.SupportGroupResult, error)
GetSupportGroupsByIssueIDs returns support groups grouped by issue ID. Join path: IssueMatch -> ComponentInstance -> Service -> SupportGroupService -> SupportGroup
func (*SqlDatabase) GetSupportGroupsByServiceIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetSupportGroupsByServiceIDs(ctx context.Context, serviceIDs []int64) (map[int64][]entity.SupportGroup, error)
GetSupportGroupsByServiceIDs returns support groups grouped by service ID in a single query. This eliminates N+1 queries when loading support groups for multiple services.
func (*SqlDatabase) GetType ¶
func (s *SqlDatabase) GetType(ctx context.Context, filter *entity.ComponentInstanceFilter) ([]string, error)
func (*SqlDatabase) GetUniqueUserIDs ¶
func (s *SqlDatabase) GetUniqueUserIDs(ctx context.Context, filter *entity.UserFilter) ([]string, error)
func (*SqlDatabase) GetUserNames ¶
func (s *SqlDatabase) GetUserNames(ctx context.Context, filter *entity.UserFilter) ([]string, error)
func (*SqlDatabase) GetUsers ¶
func (s *SqlDatabase) GetUsers(ctx context.Context, filter *entity.UserFilter) ([]entity.UserResult, error)
func (*SqlDatabase) GetVersionsByComponentIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetVersionsByComponentIDs(ctx context.Context, componentIDs []int64, serviceCCRN []*string) (map[int64][]entity.ComponentVersionResult, error)
GetVersionsByComponentIDs returns component versions grouped by component ID in a single query. This eliminates N+1 queries when loading versions for multiple images. The optional serviceCCRN filter restricts results to versions that have component instances associated with the specified services.
func (*SqlDatabase) GetVulnerabilitiesByComponentIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetVulnerabilitiesByComponentIDs(ctx context.Context, componentIDs []int64) (map[int64][]entity.VulnerabilityResult, error)
GetVulnerabilitiesByComponentIDs returns active vulnerabilities grouped by component ID using the mvVulnerabilityList materialized view. This eliminates N+1 queries when loading nested vulnerabilities for multiple images. Join path: ComponentVersionIssue → ComponentVersion → Issue → mvVulnerabilityList
func (*SqlDatabase) GetVulnerabilityAggregatesByIssueIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetVulnerabilityAggregatesByIssueIDs(ctx context.Context, issueIDs []int64) (map[int64]entity.VulnerabilityAggregate, error)
GetVulnerabilityAggregatesByIssueIDs reads pre-computed severity, remediation date, and source URL from the mvVulnerabilityList materialized view. This replaces 3 separate batch queries (GetMaxSeverityByIssueIDs, GetEarliestRemediationByIssueIDs, GetSourceURLsByIssueIDs) with a single indexed lookup when the MV is available.
func (*SqlDatabase) GetVulnerabilityCountsByComponentIDs ¶ added in v1.63.0
func (s *SqlDatabase) GetVulnerabilityCountsByComponentIDs(ctx context.Context, componentIDs []int64) (map[int64]int, error)
GetVulnerabilityCountsByComponentIDs returns the total count of active vulnerabilities per component ID using the mvVulnerabilityList materialized view.
func (*SqlDatabase) GrantAccess ¶
func (s *SqlDatabase) GrantAccess(username string, database string, host string) error
func (*SqlDatabase) RemoveAllIssuesFromComponentVersion ¶ added in v1.42.0
func (s *SqlDatabase) RemoveAllIssuesFromComponentVersion(componentVersionId int64) error
func (*SqlDatabase) RemoveComponentVersionFromIssue ¶
func (s *SqlDatabase) RemoveComponentVersionFromIssue(issueId int64, componentVersionId int64) error
func (*SqlDatabase) RemoveIssueRepositoryFromService ¶
func (s *SqlDatabase) RemoveIssueRepositoryFromService(serviceId int64, issueRepositoryId int64) error
func (*SqlDatabase) RemoveOwnerFromService ¶
func (s *SqlDatabase) RemoveOwnerFromService(serviceId int64, userId int64) error
func (*SqlDatabase) RemoveServiceFromSupportGroup ¶
func (s *SqlDatabase) RemoveServiceFromSupportGroup(supportGroupId int64, serviceId int64) error
func (*SqlDatabase) RemoveUserFromSupportGroup ¶
func (s *SqlDatabase) RemoveUserFromSupportGroup(supportGroupId int64, userId int64) error
func (*SqlDatabase) ScannerRunByUUID ¶
func (s *SqlDatabase) ScannerRunByUUID(uuid string) (*entity.ScannerRun, error)
func (*SqlDatabase) UpdateComponent ¶
func (s *SqlDatabase) UpdateComponent(component *entity.Component) error
func (*SqlDatabase) UpdateComponentInstance ¶
func (s *SqlDatabase) UpdateComponentInstance(componentInstance *entity.ComponentInstance) error
func (*SqlDatabase) UpdateComponentVersion ¶
func (s *SqlDatabase) UpdateComponentVersion(componentVersion *entity.ComponentVersion) error
func (*SqlDatabase) UpdateIssue ¶
func (s *SqlDatabase) UpdateIssue(issue *entity.Issue) error
func (*SqlDatabase) UpdateIssueMatch ¶
func (s *SqlDatabase) UpdateIssueMatch(issueMatch *entity.IssueMatch) error
func (*SqlDatabase) UpdateIssueRepository ¶
func (s *SqlDatabase) UpdateIssueRepository(issueRepository *entity.IssueRepository) error
func (*SqlDatabase) UpdateIssueVariant ¶
func (s *SqlDatabase) UpdateIssueVariant(issueVariant *entity.IssueVariant) error
func (*SqlDatabase) UpdateRemediation ¶ added in v1.25.0
func (s *SqlDatabase) UpdateRemediation(remediation *entity.Remediation) error
func (*SqlDatabase) UpdateService ¶
func (s *SqlDatabase) UpdateService(service *entity.Service) error
func (*SqlDatabase) UpdateSupportGroup ¶
func (s *SqlDatabase) UpdateSupportGroup(supportGroup *entity.SupportGroup) error
func (*SqlDatabase) UpdateUser ¶
func (s *SqlDatabase) UpdateUser(user *entity.User) error
func (*SqlDatabase) WaitPostMigrations ¶ added in v1.21.0
func (s *SqlDatabase) WaitPostMigrations() error
type Statement ¶ added in v1.60.3
type Statement[T entity.Filter] struct { Db Db L *logrus.Entry Obj Object[T] BaseQuery sq.SelectBuilder Order *Order WithCursor bool }
TODO: move to member of DbObject
type Stmt ¶ added in v1.17.3
type SupportGroupRow ¶
type SupportGroupRow struct {
Id sql.NullInt64 `db:"supportgroup_id" json:"id"`
CCRN sql.NullString `db:"supportgroup_ccrn" json:"ccrn"`
CreatedAt sql.NullTime `db:"supportgroup_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"supportgroup_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"supportgroup_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"supportgroup_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"supportgroup_updated_by" json:"updated_by"`
}
func (SupportGroupRow) AsSupportGroup ¶
func (sgr SupportGroupRow) AsSupportGroup() entity.SupportGroup
func (*SupportGroupRow) FromEntity ¶ added in v1.54.0
func (sgr *SupportGroupRow) FromEntity(sg *entity.SupportGroup)
func (*SupportGroupRow) FromSupportGroup ¶
func (sgr *SupportGroupRow) FromSupportGroup(sg *entity.SupportGroup)
func (*SupportGroupRow) ToEntity ¶ added in v1.54.0
func (sgr *SupportGroupRow) ToEntity() *entity.SupportGroup
type SupportGroupServiceRow ¶
type SupportGroupServiceRow struct {
SupportGroupId sql.NullInt64 `db:"supportgroupservice_support_group_id" json:"support_group_id"`
ServiceId sql.NullInt64 `db:"supportgroupservice_service_id" json:"service_id"`
CreatedAt sql.NullTime `db:"supportgroupservice_created_at" json:"created_at"`
DeletedAt sql.NullTime `db:"supportgroupservice_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"supportgroupservice_updated_at" json:"updated_at"`
}
type SupportGroupUserRow ¶
type SupportGroupUserRow struct {
SupportGroupId sql.NullInt64 `db:"supportgroupuser_support_group_id" json:"support_group_id"`
UserId sql.NullInt64 `db:"supportgroupuser_user_id" json:"user_id"`
CreatedAt sql.NullTime `db:"supportgroupuser_created_at" json:"created_at"`
DeletedAt sql.NullTime `db:"supportgroupuser_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"supportgroupuser_updated_at" json:"updated_at"`
}
type TraceDb ¶ added in v1.17.0
type TraceDb struct {
// contains filtered or unexported fields
}
TraceDb
func (*TraceDb) GetDbInstance ¶ added in v1.17.0
func (*TraceDb) PrepareNamed ¶ added in v1.17.0
func (*TraceDb) PreparexContext ¶ added in v1.60.1
func (*TraceDb) QueryContext ¶ added in v1.60.1
type TraceNamedStmt ¶ added in v1.17.3
type TraceNamedStmt struct {
// contains filtered or unexported fields
}
TraceNamedStmt
func (*TraceNamedStmt) Close ¶ added in v1.17.3
func (tns *TraceNamedStmt) Close() error
type TraceSqlRows ¶ added in v1.17.3
type TraceSqlRows struct {
// contains filtered or unexported fields
}
TraceSqlRows
func (*TraceSqlRows) Close ¶ added in v1.17.3
func (tsr *TraceSqlRows) Close() error
func (*TraceSqlRows) Err ¶ added in v1.17.3
func (tsr *TraceSqlRows) Err() error
func (*TraceSqlRows) Next ¶ added in v1.17.3
func (tsr *TraceSqlRows) Next() bool
func (*TraceSqlRows) Scan ¶ added in v1.17.3
func (tsr *TraceSqlRows) Scan(dest ...any) error
type TraceStmt ¶ added in v1.17.3
type TraceStmt struct {
// contains filtered or unexported fields
}
TraceStmt
type UserRow ¶
type UserRow struct {
Id sql.NullInt64 `db:"user_id" json:"id"`
Name sql.NullString `db:"user_name" json:"ccrn"`
UniqueUserID sql.NullString `db:"user_unique_user_id" json:"unique_user_id"`
Type sql.NullInt64 `db:"user_type" json:"type"`
CreatedAt sql.NullTime `db:"user_created_at" json:"created_at"`
CreatedBy sql.NullInt64 `db:"user_created_by" json:"created_by"`
DeletedAt sql.NullTime `db:"user_deleted_at" json:"deleted_at"`
UpdatedAt sql.NullTime `db:"user_updated_at" json:"updated_at"`
UpdatedBy sql.NullInt64 `db:"user_updated_by" json:"Updated_by"`
Email sql.NullString `db:"user_email" json:"email"`
}
func (*UserRow) FromEntity ¶ added in v1.54.0
Source Files
¶
- autopatch.go
- component.go
- component_instance.go
- component_version.go
- cursor.go
- database.go
- db.go
- db_object.go
- dbconn.go
- entity.go
- image_batch.go
- issue.go
- issue_match.go
- issue_repository.go
- issue_variant.go
- migration.go
- mv_vulnerabilities.go
- order.go
- patch.go
- quiet_db.go
- remediation.go
- scanner_run.go
- service.go
- service_batch.go
- service_issue_variant.go
- support_group.go
- trace_db.go
- user.go
- vulnerability_batch.go