Documentation ¶
Index ¶
- Constants
- Variables
- func Color(value string) string
- func DurationInMilliseconds(d time.Duration) string
- func Elapsed(duration int64, empty string) string
- func FileSize(bytes int64) string
- func FileSizeWithPrecision(bytes int64, precision int64) string
- func FloatWithPrecision(value float64, precision int64) string
- func IntWithSeparators(number int64) string
- func JSONBytes(data []byte) (string, error)
- func JSONString(data string) (string, error)
- func SQL(sql string) (string, error)
- func UnixTimestamp(sec int64, layout string) string
- func XML(xmlString string) (string, error)
Constants ¶
View Source
const ( // BYTE defines a filesize of 1 byte BYTE = 1.0 // KILOBYTE defines a filesize of 1 kilobyte KILOBYTE = 1000 * BYTE // MEGABYTE defines a filesize of 1 megabyte MEGABYTE = 1000 * KILOBYTE // GIGABYTE defines a filesize of 1 gigabyte GIGABYTE = 1000 * MEGABYTE // TERABYTE defines a filesize of 1 terabyte TERABYTE = 1000 * GIGABYTE )
Variables ¶
View Source
var ( // ErrSQLInvalidStatement is the error returned when the SQL statement is invalid ErrSQLInvalidStatement = errors.New("Invalid SQL statement") )
Functions ¶
func Color ¶
Color formats a color by:
- Stripping the # prefix - Changing all components to uppercase - Making sure it contains 6 digits
func DurationInMilliseconds ¶
DurationInMilliseconds formats a duration as milliseconds (including the suffix "ms")
func Elapsed ¶
Elapsed forrmats a duration in HH:MM:SS showing empty if the duration is less or equal than 0
func FileSizeWithPrecision ¶
FileSizeWithPrecision formats the filesize as a string with a custom precision
func FloatWithPrecision ¶
FloatWithPrecision formats a float with a custom precision
func IntWithSeparators ¶
IntWithSeparators formats an integer with separators using the language Dutch
func JSONString ¶
JSONString pretty prints a JSON string
func UnixTimestamp ¶
UnixTimestamp formats a unix timestamp with the given layout
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.