util

module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT

README

Livesport TV Utils

Go Reference Latest release tests Go Report Card codecov

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.

Date

import "go.lstv.dev/util/date"
  • Type Date represents date (year, month, day).
  • Function New to create new date.
  • Function DateFromTime to create date from time.Time.
  • Type DateFilter to work with date intervals and filtering.

Roman

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.

Sem

import "go.lstv.dev/util/sem"
  • Type Version represents semantic version.
  • Functions:
    • Compare, CompareVersion and CompareTag
    • Latest, LatestVersion and LatestTag
    • Parse, ParseVersion and ParseTag
  • See Semantic Versioning 2.0.0 for more details.

Size

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"})

Test

import "go.lstv.dev/util/test"
  • Provides functions to test marshal and unmarshal methods:
    • MarshalBinary and UnmarshalBinary
    • MarshalText and UnmarshalText
    • MarshalJSON and UnmarshalJSON
  • See examples.

UUID

import "go.lstv.dev/util/uu"
  • Provides type ID to keep, marshal and unmarshal UUID values.

Directories

Path Synopsis
Package constraint contains generic support and helper functions.
Package constraint contains generic support and helper functions.
Package date provides type Date to keep, marshal and unmarshal date values.
Package date provides type Date to keep, marshal and unmarshal date values.
Package roman provides type Number to keep and convert roman number to decimal number and vice versa.
Package roman provides type Number to keep and convert roman number to decimal number and vice versa.
Package sem provides type Ver to keep, marshal and unmarshal version values.
Package sem provides type Ver to keep, marshal and unmarshal version values.
Package size provides type Size to keep, marshal and unmarshal times-byte size values.
Package size provides type Size to keep, marshal and unmarshal times-byte size values.
Package test contains functions to support advanced testing.
Package test contains functions to support advanced testing.
Package uu provides type ID to keep, marshal and unmarshal UUID values.
Package uu provides type ID to keep, marshal and unmarshal UUID values.

Jump to

Keyboard shortcuts

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