bean

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCPUUnit

func GetCPUUnit() map[CPUUnitStr]serviceBean.Unit

func GetMemoryUnit

func GetMemoryUnit() map[MemoryUnitStr]serviceBean.Unit

func GetNoUnit

func GetNoUnit() map[NoUnitStr]serviceBean.Unit

func GetTimeUnit

func GetTimeUnit() map[TimeUnitStr]serviceBean.Unit

Types

type CPUUnitStr

type CPUUnitStr string
const (
	CORE  CPUUnitStr = "Core"
	MILLI CPUUnitStr = "m"
)

func (CPUUnitStr) GetUnit

func (cpuUnitStr CPUUnitStr) GetUnit() (serviceBean.Unit, bool)

func (CPUUnitStr) GetUnitSuffix

func (cpuUnitStr CPUUnitStr) GetUnitSuffix() UnitType

func (CPUUnitStr) String

func (cpuUnitStr CPUUnitStr) String() string

type ConfigValue

type ConfigValue[T any] struct {
	Unit  serviceBean.Unit
	Value T
}

func NewConfigValue

func NewConfigValue[T any](unit serviceBean.Unit, value T) *ConfigValue[T]

func (*ConfigValue[_]) IsEmpty

func (c *ConfigValue[_]) IsEmpty() bool

type MemoryUnitStr

type MemoryUnitStr string
const (
	MILLIBYTE MemoryUnitStr = "m"
	BYTE      MemoryUnitStr = "byte"
	KIBYTE    MemoryUnitStr = "Ki"
	MIBYTE    MemoryUnitStr = "Mi"
	GIBYTE    MemoryUnitStr = "Gi"
	TIBYTE    MemoryUnitStr = "Ti"
	PIBYTE    MemoryUnitStr = "Pi"
	EIBYTE    MemoryUnitStr = "Ei"
	KBYTE     MemoryUnitStr = "k"
	MBYTE     MemoryUnitStr = "M"
	GBYTE     MemoryUnitStr = "G"
	TBYTE     MemoryUnitStr = "T"
	PBYTE     MemoryUnitStr = "P"
	EBYTE     MemoryUnitStr = "E"
)

func (MemoryUnitStr) GetUnit

func (memoryUnitStr MemoryUnitStr) GetUnit() (serviceBean.Unit, bool)

func (MemoryUnitStr) GetUnitSuffix

func (memoryUnitStr MemoryUnitStr) GetUnitSuffix() UnitType

func (MemoryUnitStr) String

func (memoryUnitStr MemoryUnitStr) String() string

type NoUnitStr

type NoUnitStr string
const (
	NoUnit NoUnitStr = ""
)

func (NoUnitStr) GetUnit

func (noUnitStr NoUnitStr) GetUnit() (serviceBean.Unit, bool)

func (NoUnitStr) GetUnitSuffix

func (noUnitStr NoUnitStr) GetUnitSuffix() UnitType

GetUnitSuffix returns the UnitSuffix for NoUnit (just return 20 as it represents no unit)

func (NoUnitStr) String

func (noUnitStr NoUnitStr) String() string

type ParsedValue

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

func NewParsedValue

func NewParsedValue() *ParsedValue

func (*ParsedValue) GetUnitType

func (p *ParsedValue) GetUnitType() UnitType

func (*ParsedValue) GetValueString

func (p *ParsedValue) GetValueString() string

func (*ParsedValue) WithUnit

func (p *ParsedValue) WithUnit(unit UnitType) *ParsedValue

func (*ParsedValue) WithValueString

func (p *ParsedValue) WithValueString(value string) *ParsedValue

type TimeUnitStr

type TimeUnitStr string
const (
	SecondStr TimeUnitStr = "Seconds"
	MinuteStr TimeUnitStr = "Minutes"
	HourStr   TimeUnitStr = "Hours"
)

func (TimeUnitStr) GetUnit

func (timeUnitStr TimeUnitStr) GetUnit() (serviceBean.Unit, bool)

func (TimeUnitStr) GetUnitSuffix

func (timeUnitStr TimeUnitStr) GetUnitSuffix() UnitType

func (TimeUnitStr) String

func (timeUnitStr TimeUnitStr) String() string

type UnitType

type UnitType int
const (
	Byte      UnitType = 1
	KiByte    UnitType = 2 // 1024
	MiByte    UnitType = 3
	GiByte    UnitType = 4
	TiByte    UnitType = 5
	PiByte    UnitType = 6
	EiByte    UnitType = 7
	K         UnitType = 8 // 1000
	M         UnitType = 9
	G         UnitType = 10
	T         UnitType = 11
	P         UnitType = 12
	E         UnitType = 13
	Core      UnitType = 14 // CPU cores
	Milli     UnitType = 15
	Second    UnitType = 16
	Minute    UnitType = 17
	Hour      UnitType = 18
	MilliByte UnitType = 19
	NoSuffix  UnitType = 20
)

func (UnitType) GetCPUUnitStr

func (unitType UnitType) GetCPUUnitStr() CPUUnitStr

func (UnitType) GetMemoryUnitStr

func (unitType UnitType) GetMemoryUnitStr() MemoryUnitStr

func (UnitType) GetNoUnitStr

func (unitType UnitType) GetNoUnitStr() NoUnitStr

func (UnitType) GetTimeUnitStr

func (unitType UnitType) GetTimeUnitStr() TimeUnitStr

Jump to

Keyboard shortcuts

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