Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capability ¶
type Capability string
Capability defines what a type can do.
const ( CapRead Capability = "read" CapWrite Capability = "write" CapIncDec Capability = "inc_dec" CapToggle Capability = "toggle" CapTextEdit Capability = "text_edit" )
type Property ¶
type Property interface {
// Descriptor returns metadata about the property.
Descriptor() PropertyDescriptor
// LoadValue returns the current value as an interface{}.
LoadValue() interface{}
// StoreValue sets the value. It assumes the value is valid.
StoreValue(val interface{}) error
// Parse converts a string to the underlying value type.
Parse(valStr string) (interface{}, error)
// SetFromString parses and sets the value from a string.
// This is the primary entry point for TUI edits.
SetFromString(valStr string) error
// Validate checks if a value is valid without setting it.
// Used for pre-flight checks.
Validate(val interface{}) error
}
Property is the interface that all exposed types must implement. This decouples the Bridge from specific atomic implementations.
type PropertyDescriptor ¶
type PropertyDescriptor struct {
Name string // Variable name (Admin Label)
Type string // Go Type (e.g., "int", "*atomic.Int")
Capabilities []Capability // List of supported actions
}
PropertyDescriptor holds metadata about an exposed variable.
type ValidatedProperty ¶
type ValidatedProperty struct {
Property
// contains filtered or unexported fields
}
ValidatedProperty wraps a Property and enforces constraints.
func NewValidatedProperty ¶
func NewValidatedProperty(p Property, validators ...Validator) *ValidatedProperty
func (*ValidatedProperty) SetFromString ¶
func (vp *ValidatedProperty) SetFromString(valStr string) error
SetFromString validates before storing.
func (*ValidatedProperty) StoreValue ¶
func (vp *ValidatedProperty) StoreValue(val interface{}) error
StoreValue validates before storing.
func (*ValidatedProperty) Validate ¶
func (vp *ValidatedProperty) Validate(val interface{}) error
Validate calls internal property validation AND external validators.
Click to show internal directories.
Click to hide internal directories.