parseutil

package module
v0.0.0-...-045d54e Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

parseutil

Utility functions for parsing text values in Go (golang)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DateTime

func DateTime(value string) (time.Time, error)

DateTime parses a date with, optionally a time and a timezone in an RFC3339 style. The accepted formats are:

  • 2006-01-02 (interpred as 0 hour, 0 minute and 0 second)
  • 2006-01-02Z07:00 (same as the previous one, but with TZ)
  • 2006-01-02T15:04:05
  • 2006-01-02T15:04:05Z07:00 (time.RFC3339)
  • 2006-01-02T15:04:05.999999999Z07:00 (time.RFC3339Nano)

In all dates, the second number indicates the month and the third, the day. Number values less than ten must have a leading zero.

Note that the format Z07:00 indicates that the timezone can be specified as either Z (UTC) or either (+|-)hh:mm.

func Size

func Size(s string) (uint64, error)

Size parses a size with an optional suffix indicating the unit and returns the size in bytes Supported suffixes (case insensitive):

K, KB: kilobytes
M, MB: megabytes
G, GB: gigabytes
T, TB: terabytes

The number before the suffix is parsed as a float, so the size might be specified with decimal places like e.g. 1.5GB.

Types

This section is empty.

Jump to

Keyboard shortcuts

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