Categorygithub.com/savannahghi/scalarutils
modulepackage
0.0.4
Repository: https://github.com/savannahghi/scalarutils.git
Documentation: pkg.go.dev

# README

Linting and Tests Coverage Status

Scalar Utils Library

scalarutils are utilities used by several backend services.

Installing it

scalarutils is compatible with modern Go releases in module mode, with Go installed:

go get -u github.com/savannahghi/scalarutils

will resolve and add the package to the current development module, along with its dependencies.

Alternatively the same can be achieved if you use import in a package:

import "github.com/savannahghi/scalarutils"

and run go get without parameters.

The package name is scalarutils

Developing

The default branch library is main

We try to follow semantic versioning ( https://semver.org/ ). For that reason, every major, minor and point release should be tagged.

git tag -m "v0.0.1" "v0.0.1"
git push --tags

Continuous integration tests must pass on Travis CI. Our coverage threshold is 90% i.e you must keep coverage above 90%.

Environment variables

In order to run tests, you need to have an env.sh file similar to this one:

# Application settings
export DEBUG=true
export IS_RUNNING_TESTS=true
export SENTRY_DSN=<a Sentry Data Source Name>
export GOOGLE_CLOUD_PROJECT="Google Cloud project id"

This file must not be committed to version control.

It is important to export the environment variables. If they are not exported, they will not be visible to child processes e.g go test ./....

These environment variables should also be set up on Travis CI environment variable section.

Contributing

I would like to cover the entire GitHub API and contributions are of course always welcome. The calling pattern is pretty well established, so adding new methods is relatively straightforward. See CONTRIBUTING.md for details.

Versioning

In general, scalarutils follows semver as closely as we can for tagging releases of the package. For self-contained libraries, the application of semantic versioning is relatively straightforward and generally understood. We've adopted the following versioning policy:

  • We increment the major version with any incompatible change to non-preview functionality, including changes to the exported Go API surface or behavior of the API.
  • We increment the minor version with any backwards-compatible changes to functionality, as well as any changes to preview functionality in the GitHub API. GitHub makes no guarantee about the stability of preview functionality, so neither do we consider it a stable part of the go-github API.
  • We increment the patch version with any backwards-compatible bug fixes.

License

This library is distributed under the MIT license found in the LICENSE file.

# Functions

NewDate initializes and validates a date.

# Constants

DateLayout is a short version of the date format.
DateTimeFormatLayout is the default format with East African Timezone.

# Structs

Date is a custom date type that maintains only date level precision.

# Type aliases

Base64Binary is a stream of bytes.
Canonical is a URI that is a reference to a canonical URL on a FHIR resource.
Code is a string which has at least one character and no leading or trailing whitespace and where there is no whitespace other than single spaces in the contents.
DateTime is a date, date-time or partial date (e.g.
Decimal is a rational number with implicit precision.
Instant is an instant in time - known at least to the second.
Markdown is a string that may contain Github Flavored Markdown syntax for optional processing by a mark down presentation engine.
OID is an OID represented as a URI.
URI is string of characters used to identify a name or a resource.
URL is a URI that is a literal reference.
UUID is a UUID, represented as a URI.
XHTML is xhtml - escaped html (see specfication).