utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculatePercentage

func CalculatePercentage(used, total float64) float64

CalculatePercentage safely calculates percentage from used and total values Returns 0.0 if total is 0 to avoid division by zero

func CalculatePercentageInt

func CalculatePercentageInt(used, total int64) float64

CalculatePercentageInt safely calculates percentage from used and total int64 values Returns 0.0 if total is 0 to avoid division by zero

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes formats a byte count to a human-readable format with dynamic units Always shows 2 decimal places and chooses the most appropriate unit (GB, TB, PB)

func FormatBytesFloat

func FormatBytesFloat(gb float64) string

FormatBytesFloat converts float64 GB values to human-readable format Input is assumed to be in GB, converts to appropriate units with 2 decimal places

func FormatStatusIndicator

func FormatStatusIndicator(status string) string

FormatStatusIndicator returns a string with a colored status emoji. Green ▲ for online/running, Red ▼ for offline/stopped, Yellow ● for others.

func FormatUptime

func FormatUptime(uptime int) string

FormatUptime formats the uptime in seconds to a human-readable format

Types

This section is empty.

Jump to

Keyboard shortcuts

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