Documentation ¶
Index ¶
- Constants
- func Add(a time.Time, b time.Duration) time.Time
- func After(a, b time.Time) bool
- func AfterDuration(a, b time.Duration) bool
- func AfterOrEqual(a, b time.Time) bool
- func AfterOrEqualDuration(a, b time.Duration) bool
- func Age(s string) time.Duration
- func Before(a, b time.Time) bool
- func BeforeDuration(a, b time.Duration) bool
- func BeforeOrEqual(a, b time.Time) bool
- func BeforeOrEqualDuration(a, b time.Duration) bool
- func Date(s string) time.Time
- func Duration(s string) time.Duration
- func EqualDuration(a, b time.Duration) bool
- func EqualTime(a, b time.Time) bool
- func GetTemplateFuncs() gotemplate.FuncMap
- func HumanizeBytes(size interface{}) string
- func HumanizeDuration(d time.Duration) string
- func MakeExpressionEnvs(envs map[string]interface{}) map[string]interface{}
- func MakeExpressionOptions(envs map[string]interface{}) []expr.Option
- func ParseDuration(val string) (*time.Duration, error)
- func SafeRead(r io.Reader) string
- func Sub(a, b time.Time) time.Duration
- func Template(template string, vars interface{}) (string, error)
- func TemplateWithDelims(template, openingDelims, closingDelims string, vars interface{}) (string, error)
- func ToFile(text string, ext string) string
Constants ¶
const ( BYTE = 1 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE TERABYTE PETABYTE EXABYTE )
Variables ¶
This section is empty.
Functions ¶
func AfterDuration ¶ added in v1.5.10
func AfterOrEqual ¶ added in v1.5.10
func AfterOrEqualDuration ¶ added in v1.5.10
func BeforeDuration ¶ added in v1.5.10
func BeforeOrEqual ¶ added in v1.5.10
func BeforeOrEqualDuration ¶ added in v1.5.10
func EqualDuration ¶ added in v1.5.10
func GetTemplateFuncs ¶ added in v1.5.9
func GetTemplateFuncs() gotemplate.FuncMap
func HumanizeBytes ¶ added in v1.5.2
func HumanizeBytes(size interface{}) string
ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:
E: Exabyte P: Petabyte T: Terabyte G: Gigabyte M: Megabyte K: Kilobyte B: Byte
The unit that results in the smallest number greater than or equal to 1 is always chosen. Input is the size in bytes.
func HumanizeDuration ¶ added in v1.5.2
Returns a string representing of a duration in the form "3d1h3m".
Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. Duration more than a day or more than a week lose granularity and are truncated to resp. days-hours-minutes and weeks-days-hours. The zero duration formats as 0s.
func MakeExpressionEnvs ¶ added in v1.5.10
func MakeExpressionOptions ¶ added in v1.5.10
func TemplateWithDelims ¶ added in v1.5.8
func TemplateWithDelims(template, openingDelims, closingDelims string, vars interface{}) (string, error)
TemplateWithDelims templates out a template using gomplate using the given opening and closing Delims
Types ¶
This section is empty.