Skip to content
/ util Public

Livesport TV Utils: date, roman numbers, semver, size in bytes, tests and uuid

License

Notifications You must be signed in to change notification settings

bafko/util

Repository files navigation

Livesport TV Utils

Go Reference Latest release License: MIT 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.

About

Livesport TV Utils: date, roman numbers, semver, size in bytes, tests and uuid

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published