Categorygithub.com/tozny/utils-go
modulepackage
0.0.66
Repository: https://github.com/tozny/utils-go.git
Documentation: pkg.go.dev

# README

utils-go

This module contains common functions and types that have utility across tozny golang based repositories.

Build

To "build" this module, type

make lint

this will run the go psuedo-compiler and linter tool vet, along with the mod tool to handle golang source code dependency management.

Development

Checkout branch to work on. Write code on that branch. Make a commit on that branch. Push branch & commit. From other repository that depends on this module, fetch the committed changes by running

go get github.com/tozny/utils-go@GITCOMMITSHA

Iterate on committed changes from within dependent repository.

Publishing

Follow semantic versioning when releasing new versions of this library.

Releasing involves tagging a commit in this repository, and pushing the tag. Tagging and releasing of new versions should only be done from the master branch after an approved Pull Request has been merged, or on the branch of an approved Pull Request.

To publish a new version, run

git tag vX.Y.Z
git push origin vX.Y.Z

or using the make version command

make version version=X.Y.Z

To consume published updates from other repositories that depends on this module run

go get github.com/tozny/[email protected]

and the go get tool will fetch the published artifact and update that modules go.mod andgo.sum files with the updated dependency. Currently the list of modules that depend on this module are

# Packages

No description provided by the author
Package cache contains concrete implementations of clients for interacting with cache datastores.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package queue provides definition and implementations of the Queue interface for passing messages between services using distributed persistence storage backends (e.g.
No description provided by the author
Package stream provides definition and implementations of a Stream for publishing and subscribing to events using a distributed and persistent streaming message processing backend (e.g.
Package test provides helper functions and common structs for use in tests across tozny golang repositories.
No description provided by the author

# Functions

Await waits until the ready function is ready or errors, returning success and error (if any).
AwaitInterval waits until the ready function is ready or errors, returning success and error (if any).
EnvOrDefault fetches an environment variable value, or if not set returns the fallback value.
HashAndEncodeString uses blake2b to hash the provided string and returns the result in a base64 url encoded format.
MustGetenv attempts to lookup and return the value associated with the specified environment variable identifier, panic'ing if no value is associated with that identifier.
MustGetenvBool attempts to lookup and return the value associated with the specified environment variable identifier and cast it to a bool, panic'ing if no value is associated with that identifier, if it cannot be cast.
MustGetenvFloat attempts to lookup and return the value associated with the specified environment variable identifier and cast it to a float, panic'ing if no value is associated with that identifier or it cannot be cast.
MustGetenvFloatNonZero attempts to lookup and return the value associated with the specified environment variable identifier and cast it to a float, panic'ing if no value is associated with that identifier, if it cannot be cast, or if once cast equals zero.
MustGetenvInt attempts to lookup and return the value associated with the specified environment variable identifier and cast it to an int, panic'ing if no value is associated with that identifier or it cannot be cast.
MustGetenvIntNonZero attempts to lookup and return the value associated with the specified environment variable identifier and cast it to an int, panic'ing if no value is associated with that identifier, if it cannot be cast, or if once cast equals zero.
TransitiveMustGetenv will (if a transitive dependnecy such as the value of another environment is set) attempt to lookup the specified environment variable and return its string panicing if not provided.
TransitiveMustGetenvBool will (if a transitive dependnecy such as the value of another environment is set) attempt to lookup the specified environment variable parsed as a bool and return its value panicing if not provided.
TransitiveMustGetenvFloat will (if a transitive dependnecy such as the value of another environment is set) attempt to lookup the specified environment variable parsed as a float and return its value panicing if not provided.
TransitiveMustGetenvInt will (if a transitive dependnecy such as the value of another environment is set) attempt to lookup the specified environment variable parsed as an int and return its value panicing if not provided.

# Type aliases

Ready is a type of function that reports readiness of some state or action, returning bool for readiness and error (if any).