Documentation
¶
Index ¶
- Constants
- Variables
- func DiscoverContainerSocket() (string, bool)
- func FormatBytes(b uint64) string
- func ParseDomainFQDN(fqdn string) (string, error)
- func PrintError(err error)
- func PrintErrorWithMessage(message string, err error)
- func PrintSuccess(message string)
- func PrintWarning(message string)
- func ToBoolPtr(value any) (*bool, bool)
- func ToStringPtr(value any) (*string, bool)
- func ToTimePtr(value any) (*time.Time, bool)
- func ToUint64Ptr(value any) (*uint64, bool)
- func TransportString(method, host string, port *uint16, mxLookup bool) string
- type EmailAddress
- type EmailAddressOrWildcard
- type MaybeEmpty
- type MaybeEnabled
- type MaybeIDSuffix
- type MaybePassword
- type MaybeQuota
- type MaybeTime
- type MaybeZero
- type SQLLike
- type TestFunctionResult
Constants ¶
const ( // Common symbols SymCheckMark = "✔" SymCrossMark = "✘" SymInfinity = "∞" SymBullet = "•" )
Variables ¶
var ( BlackStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "0", Dark: "8", }) RedStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "1", Dark: "9", }) GreenStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "2", Dark: "10", }) YellowStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "3", Dark: "11", }) BlueStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "4", Dark: "12", }) MagentaStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "5", Dark: "13", }) CyanStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "6", Dark: "14", }) WhiteStyle = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{ Light: "7", Dark: "15", }) TableHeaderStyle = lipgloss.NewStyle().Bold(true).Padding(0, 1) TableRowStyle = lipgloss.NewStyle().Padding(0, 1) )
var ( ErrorPrefix = RedStyle.Bold(true).Render("Error: ") WarningPrefix = YellowStyle.Bold(true).Render("Warning: ") )
var ( TestFunctionResultStyle = TestFunctionResult{ EmptyText: "<empty>", EmptyStyle: BlackStyle, ErrorStyle: RedStyle, ValueStyle: GreenStyle, } TestFunctionResultListStyle = TestFunctionResult{ EmptyText: "<empty>", EmptyStyle: BlackStyle, ErrorStyle: RedStyle, ValueStyle: GreenStyle, } MaybeEnabledStyle = MaybeEnabled{ TrueText: SymCheckMark, TrueStyle: GreenStyle.Bold(true), FalseText: SymCrossMark, FalseStyle: RedStyle.Bold(true), InheritedFalsePrefix: "", InheritedFalseSuffix: "*", InheritedFalseStyle: RedStyle.Bold(true), NullText: "-", NullStyle: BlackStyle, } MaybeEnabledTableStyle = MaybeEnabled{ TrueText: SymCheckMark, TrueStyle: GreenStyle.Bold(true), FalseText: SymCrossMark, FalseStyle: RedStyle.Bold(true), InheritedFalsePrefix: " ", InheritedFalseSuffix: "*", InheritedFalseStyle: RedStyle.Bold(true), NullText: "-", NullStyle: BlackStyle, } MaybeEmptyStyle = MaybeEmpty{ EmptyText: "<empty>", EmptyStyle: BlackStyle, NullText: "-", NullStyle: BlackStyle, } MaybeWildcardNameStyle = MaybeEmpty{ NullText: "%", NullStyle: CyanStyle.Bold(true), } MaybeZeroStyle = MaybeZero{ ZeroText: "0", ZeroStyle: YellowStyle.Bold(true), } MaybeTimeStyle = MaybeTime{ NullText: "-", NullStyle: BlackStyle, Format: "2006-01-02 15:04:05", } MaybeIDSuffixStyle = MaybeIDSuffix{ SuffixStyle: BlueStyle, NullText: "-", NullStyle: BlackStyle, } MaybePasswordStyle = MaybePassword{ NullText: "-", NullStyle: BlackStyle, HiddenText: "***", HiddenStyle: BlueStyle.Bold(true), } MaybeQuotaStyle = MaybeQuota{ UnlimitedText: SymInfinity, UnlimitedStyle: MagentaStyle.Bold(true), } SQLLikeStyle = SQLLike{ WildcardStyle: CyanStyle.Bold(true), } )
Functions ¶
func DiscoverContainerSocket ¶ added in v0.1.6
DiscoverContainerSocket resolves the Docker-compatible socket.
func FormatBytes ¶
FormatBytes converts a size in bytes (uint64) to a human-readable string using 1024-based units. Examples:
0 -> "0 B" 512 -> "512 B" 1536 -> "1.5 KB" 1048576 -> "1 MB"
func ParseDomainFQDN ¶
ParseDomainFQDN validates a domain using the same rules as the SQL schema.
func PrintError ¶
func PrintError(err error)
func PrintErrorWithMessage ¶
func PrintSuccess ¶
func PrintSuccess(message string)
func PrintWarning ¶
func PrintWarning(message string)
func ToBoolPtr ¶
ToBoolPtr converts various types to a *bool. Supported are: bool, *bool, sql.NullBool.
func ToStringPtr ¶
ToStringPtr converts various types to a *string. Supported are: string, *string, sql.NullString.
func ToTimePtr ¶
ToTimePtr converts various types to a *time.Time. Supported are: time.Time, *time.Time, sql.NullTime.
func ToUint64Ptr ¶
ToUint64Ptr converts various types to a *uint64. Supported are: - uint64, *uint64, int64, *int64, sql.NullInt64 - uint32, *uint32, int32, *int32, sql.NullInt32 - uint16, *uint16, int16, *int16, sql.NullInt16 - uint8, *uint8, int8, *int8 - uint, *uint, int, *int
Types ¶
type EmailAddress ¶
func ParseEmailAddress ¶
func ParseEmailAddress(address string) (EmailAddress, error)
func (*EmailAddress) String ¶
func (ea *EmailAddress) String() string
type EmailAddressOrWildcard ¶
func ParseEmailAddressOrWildcard ¶
func ParseEmailAddressOrWildcard(address string) (EmailAddressOrWildcard, error)
func (*EmailAddressOrWildcard) IsWildcard ¶
func (ea *EmailAddressOrWildcard) IsWildcard() bool
func (*EmailAddressOrWildcard) String ¶
func (ea *EmailAddressOrWildcard) String() string
type MaybeEmpty ¶
type MaybeEmpty struct {
EmptyText string
EmptyStyle lipgloss.Style
NullText string
NullStyle lipgloss.Style
}
func (MaybeEmpty) Render ¶
func (me MaybeEmpty) Render(value any) string
type MaybeEnabled ¶
type MaybeIDSuffix ¶
type MaybePassword ¶
type MaybePassword struct {
NullText string
NullStyle lipgloss.Style
HiddenText string
HiddenStyle lipgloss.Style
}
func (MaybePassword) Render ¶
func (mp MaybePassword) Render(isSet any) string