util

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
	TB = 1024 * GB
)

enum file size.

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) int

Atoi parse string to int, ignore errors.

func FirstNotEmpty

func FirstNotEmpty[T comparable](values ...T) T

FirstNotEmpty returns the first value not equals to the zero value.

func ToJSON

func ToJSON(v any, pretty ...bool) string

ToJSON marshal data to JSON, ignore errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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