values

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package values contains domain value objects that encapsulate primitive types with validation and such.

Index

Constants

This section is empty.

Variables

View Source
var (
	SevUnknown  = Severity{SeverityUnknown}
	SevLow      = Severity{SeverityLow}
	SevMedium   = Severity{SeverityMedium}
	SevHigh     = Severity{SeverityHigh}
	SevCritical = Severity{SeverityCritical}
)

Predefined severity values

Functions

This section is empty.

Types

type ControlID

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

ControlID uniquely identifies a control within a profile. Enforces non-empty, trimmed identifiers.

func MustNewControlID

func MustNewControlID(id string) ControlID

MustNewControlID creates a ControlID or panics (for tests/constants)

func NewControlID

func NewControlID(id string) (ControlID, error)

NewControlID creates a new ControlID with validation

func (ControlID) Equals

func (c ControlID) Equals(other ControlID) bool

Equals checks if two ControlIDs are equal

func (ControlID) IsEmpty

func (c ControlID) IsEmpty() bool

IsEmpty returns true if this is the zero value

func (ControlID) MarshalJSON

func (c ControlID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (ControlID) String

func (c ControlID) String() string

String returns the string representation

func (*ControlID) UnmarshalJSON

func (c *ControlID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type ExecutionID

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

ExecutionID uniquely identifies a profile execution. This is critical for persistence, distributed execution, and result tracking.

func FromUUID

func FromUUID(id uuid.UUID) ExecutionID

FromUUID creates an ExecutionID from a uuid.UUID

func MustParseExecutionID

func MustParseExecutionID(s string) ExecutionID

MustParseExecutionID parses a string or panics (for tests only)

func NewExecutionID

func NewExecutionID() ExecutionID

NewExecutionID creates a new random execution ID

func ParseExecutionID

func ParseExecutionID(s string) (ExecutionID, error)

ParseExecutionID parses a string into an ExecutionID

func (ExecutionID) Equals

func (e ExecutionID) Equals(other ExecutionID) bool

Equals checks if two ExecutionIDs are equal

func (ExecutionID) IsZero

func (e ExecutionID) IsZero() bool

IsZero returns true if this is the zero value

func (ExecutionID) MarshalJSON

func (e ExecutionID) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (ExecutionID) String

func (e ExecutionID) String() string

String returns the string representation

func (ExecutionID) UUID

func (e ExecutionID) UUID() uuid.UUID

UUID returns the underlying uuid.UUID

func (*ExecutionID) UnmarshalJSON

func (e *ExecutionID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type PluginName

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

PluginName represents a validated plugin identifier. Enforces non-empty, trimmed plugin names.

func MustNewPluginName

func MustNewPluginName(name string) PluginName

MustNewPluginName creates a PluginName or panics

func NewPluginName

func NewPluginName(name string) (PluginName, error)

NewPluginName creates a PluginName with strict validation. A valid plugin name must: - Be non-empty - contain only alphanumeric characters, underscores, and hyphens - NOT contain paths, dots, or special characters - Be at most 64 characters long

func (PluginName) Equals

func (p PluginName) Equals(other PluginName) bool

Equals checks if two plugin names are equal

func (PluginName) IsEmpty

func (p PluginName) IsEmpty() bool

IsEmpty returns true if this is the zero value

func (PluginName) MarshalJSON

func (p PluginName) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Uses json.Marshal for proper character escaping.

func (PluginName) String

func (p PluginName) String() string

String returns the string representation

func (*PluginName) UnmarshalJSON

func (p *PluginName) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type Severity

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

Severity represents the severity level of a control. Enforces valid severity values and provides ordering.

func MustNewSeverity

func MustNewSeverity(s string) Severity

MustNewSeverity creates a Severity or panics

func NewSeverity

func NewSeverity(s string) (Severity, error)

NewSeverity creates a Severity from string

func (Severity) Equals

func (s Severity) Equals(other Severity) bool

Equals checks if two severities are equal

func (Severity) IsHigherOrEqual

func (s Severity) IsHigherOrEqual(other Severity) bool

IsHigherOrEqual returns true if this severity is higher or equal to the other

func (Severity) IsHigherThan

func (s Severity) IsHigherThan(other Severity) bool

IsHigherThan returns true if this severity is higher than the other

func (Severity) Level

func (s Severity) Level() int

Level returns the numeric severity level (for ordering)

func (Severity) MarshalJSON

func (s Severity) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Severity) String

func (s Severity) String() string

String returns the string representation

func (*Severity) UnmarshalJSON

func (s *Severity) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type SeverityLevel

type SeverityLevel int

SeverityLevel is the internal representation

const (
	// SeverityUnknown = Unknown
	SeverityUnknown SeverityLevel = 0
	// SeverityLow = Low
	SeverityLow SeverityLevel = 1
	// SeverityMedium = Medium
	SeverityMedium SeverityLevel = 2
	// SeverityHigh = High
	SeverityHigh SeverityLevel = 3
	// SeverityCritical = Critical
	SeverityCritical SeverityLevel = 4
)

type Status

type Status string

Status represents the status of a control or observation.

const (
	// StatusPass indicates the check passed
	StatusPass Status = "pass"
	// StatusFail indicates the check failed (but ran successfully)
	StatusFail Status = "fail"
	// StatusError indicates the check encountered an error
	StatusError Status = "error"
	// StatusSkipped indicates the check was skipped (dependency failure or filtered)
	StatusSkipped Status = "skipped"
)

func (Status) IsFailure

func (s Status) IsFailure() bool

IsFailure returns true if this status represents a failure or error

func (Status) IsSkipped

func (s Status) IsSkipped() bool

IsSkipped returns true if this status represents a skip

func (Status) IsSuccess

func (s Status) IsSuccess() bool

IsSuccess returns true if this status represents success

func (Status) Precedence

func (s Status) Precedence() int

Precedence returns the numeric precedence of this status. Higher values indicate higher priority in aggregation. Used by status aggregator to determine control status.

Precedence: Fail (3) > Error (2) > Skipped (1) > Pass (0)

func (Status) Validate

func (s Status) Validate() error

Validate returns an error if the status value is invalid

Jump to

Keyboard shortcuts

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