warning

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 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 Warning

type Warning struct {
	ID              int64             `json:"-"`
	UUID            uuid.UUID         `json:"uuid"         db:"primary=yes"`
	Type            api.WarningType   `json:"type"`
	Scope           string            `json:"scope"`
	EntityType      string            `json:"entity_type"`
	Entity          string            `json:"entity"`
	Status          api.WarningStatus `json:"status"`
	FirstOccurrence time.Time         `json:"first_occurrence"`
	LastOccurrence  time.Time         `json:"last_occurrence"`
	LastUpdated     time.Time         `json:"last_updated" db:"update_timestamp"`
	Messages        []string          `json:"messages"     db:"marshal=json"`
	Count           int
}

func NewWarning

func NewWarning(warningType api.WarningType, scope api.WarningScope, message string) Warning

func (Warning) Match

func (w Warning) Match(scope api.WarningScope) bool

Match checks whether the given warning is within the given scope.

func (Warning) Validate

func (w Warning) Validate() error

type WarningEmitter added in v0.6.4

type WarningEmitter interface {
	Emit(ctx context.Context, w Warning)
	RemoveStale(ctx context.Context, scope api.WarningScope, newWarnings Warnings)
}

type WarningFilter

type WarningFilter struct {
	ID         *int64
	UUID       *uuid.UUID
	Scope      *string
	EntityType *string
	Entity     *string
	Type       *api.WarningType
}

type WarningRepo

type WarningRepo interface {
	Upsert(ctx context.Context, w Warning) (int64, error)
	GetAll(ctx context.Context) (Warnings, error)
	GetByScopeAndType(ctx context.Context, scope api.WarningScope, wType api.WarningType) (Warnings, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Warning, error)
	Update(ctx context.Context, id uuid.UUID, w Warning) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
}

type WarningService

type WarningService interface {
	GetAll(ctx context.Context) (Warnings, error)
	GetByScopeAndType(ctx context.Context, scope api.WarningScope, wType api.WarningType) (Warnings, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Warning, error)
	UpdateStatusByUUID(ctx context.Context, id uuid.UUID, status api.WarningStatus) (*Warning, error)
	DeleteByUUID(ctx context.Context, id uuid.UUID) error

	WarningEmitter
}

func NewWarningService

func NewWarningService(repo WarningRepo, opts ...WarningServiceOption) WarningService

type WarningServiceOption

type WarningServiceOption func(s *warningService)

func WithWarningServiceNow

func WithWarningServiceNow(nowFunc func() time.Time) WarningServiceOption

type Warnings

type Warnings []Warning

Directories

Path Synopsis
repo

Jump to

Keyboard shortcuts

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