conv

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MIT Imports: 3 Imported by: 18

Documentation

Overview

Packag conv provides functions for converting between different types.

Index

Constants

This section is empty.

Variables

View Source
var ByteSizeUnits = map[string]ByteSize{
	"B":  B,
	"KB": KB,
	"MB": MB,
	"GB": GB,
	"TB": TB,
	"PB": PB,
	"EB": EB,
}

ByteSizeUnits is a map of byte sizes.

Functions

func Bool added in v0.1.6

func Bool(val any) bool

Bool returns the boolean representation of the value. nolint:gocyclo

func ByteSizes added in v0.1.7

func ByteSizes(b float64, size string) int64

ByteSizes converts a value of float64 to a full integer value of a byte based on a unit size.

func String

func String(val any) string

String returns the string representation of the value.

Types

type ByteSize added in v0.1.7

type ByteSize int64

ByteSize represents the size of a value in bits.

const (
	B  ByteSize = 1
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
)

Jump to

Keyboard shortcuts

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