Open source implementation of Livesport TV utilities library.
Packages provide Formatter
and Parser
variables to override default behavior of
format methods (MarshalText
, MarshalJSON
, String
, ...)
and parse methods (UnmarshalText
, UnmarshalJSON
, ...).
Default value of Formatter
is DefaultFormatter
and default value of Parser
is DefaultParser
.
Also, specific verbs for fmt
formatting are available.
import "go.lstv.dev/util/date"
- Type
Date
represents date (year, month, day). - Function
New
to create new date. - Function
DateFromTime
to create date fromtime.Time
. - Type
DateFilter
to work with date intervals and filtering.
import "go.lstv.dev/util/roman"
- Type
Number
represents roman number. - It supports roman numerals:
M
(1000)D
(500)C
(100)L
(50)X
(10)V
(5)I
(1)
- Short and long forms are also supported and configurable.
import "go.lstv.dev/util/sem"
- Type
Version
represents semantic version. - Functions:
Compare
,CompareVersion
andCompareTag
Latest
,LatestVersion
andLatestTag
Parse
,ParseVersion
andParseTag
- See Semantic Versioning 2.0.0 for more details.
import "go.lstv.dev/util/size"
- Provides type
Size
to keep, marshal and unmarshal times-byte size values. - It supports three JSON forms:
- numeric form (JSON number is always in bytes)
- string form (JSON string with or without units)
- object form (JSON object like
{"value":1000,"unit":"MiB"}
)
import "go.lstv.dev/util/test"
- Provides functions to test marshal and unmarshal methods:
MarshalBinary
andUnmarshalBinary
MarshalText
andUnmarshalText
MarshalJSON
andUnmarshalJSON
- See examples.
import "go.lstv.dev/util/uu"
- Provides type
ID
to keep, marshal and unmarshal UUID values.