toolbox

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 0 Imported by: 0

README ΒΆ

toolbox logo

go-toolbox

A set of utility functions and classes shared between multiple Golang applications and tools






Table of Contents

πŸ‘οΈ Overview

go-toolbox contains common functions and classes that can be used by applications and utilities. This includes everything from advanced error handling to cryptographic functions to an enhanced HTTP client.

Please review the module documentation for details on how to properly the functions and classes contained in this module.

βœ… Requirements

This module is supported for Go v1.16 and later.

πŸ“ƒ License

This module is distributed under the MIT License.

❓ Questions, Issues and Feature Requests

If you have questions about this project, find a bug or wish to submit a feature request, please submit an issue.

Documentation ΒΆ

Overview ΒΆ

Package toolbox does not currently implement any functionality. The subfolders within this package provide the full functionality of the toolbox.

Any method in the toolbox which returns an error object will return a custom error type implementing the go.sophtrust.dev/pkg/toolbox/errors.ExtendedError interface. The specific errors returned by the method are noted in its documentation. Each integer code corresponding the the specific error is unique across the entire toolbox.

To determine the specific type of error that was returned, you can use 1 of 3 methods:

β—½ Use the errors.Is() method with new(ErrType) as the second argument where ErrType is the actual type of error
  that is expected.
β—½ Use the errors.As() method to determine if you can convert the error into the given object. The advantage of this
  method is that you can then also access each error's custom fields.
β—½ Cast the error object to an ExtendedError object and then use the Code() method to compare the error code to the
  corresponding error code constant defined as the error type with 'Code' appended to it (eg:
  ErrDoRequestFailureCode, ErrResourceWaitFailureCode)

Logging for methods within the toolbox is performed using either the zerolog logger object supplied in the context parameter for the method (generated by calling the logger instance's WithContext() function) or the global zerlog logger unless otherwise noted in the method's documentation.

The following error codes are allocated for each package:

β—½ collection: 1001-1250
β—½ crypto: 1251-1500
β—½ gin: 2751-3000
β—½ gin/api: 3001-3250
β—½ gin/context: 3251-3500
β—½ gin/middleware: 3501-3750
β—½ i18n: 1501-1750
β—½ k8s: 1751-2000
β—½ net: 2001-2250
β—½ net/http: 2251-2500
β—½ strings: 2501-2750

Directories ΒΆ

Path Synopsis
Package collection contains utility functions to help deal with collections such as maps and slices.
Package collection contains utility functions to help deal with collections such as maps and slices.
Package crypto contains functionality for dealing with X509 certificates and cryptography.
Package crypto contains functionality for dealing with X509 certificates and cryptography.
Package errors provides simple error handling primitives.
Package errors provides simple error handling primitives.
gin
Package gin contains additional functionality for the gin-gonic framework.
Package gin contains additional functionality for the gin-gonic framework.
api
Package api contains useful objects and methods to use with APIs.
Package api contains useful objects and methods to use with APIs.
context
Package context contains additional functionality related to the gin-gonic context.
Package context contains additional functionality related to the gin-gonic context.
middleware
Package middleware contains a collection of middleware for use with gin-gonic.
Package middleware contains a collection of middleware for use with gin-gonic.
Package i18n handles text and data translation based on various locales.
Package i18n handles text and data translation based on various locales.
Package k8s handles interacting with Kubernetes clusters.
Package k8s handles interacting with Kubernetes clusters.
net
Package net deals with networking-related functionality.
Package net deals with networking-related functionality.
http
Package http handles interacting with HTTP clients and servers.
Package http handles interacting with HTTP clients and servers.
Package strings contains helper functions related to string management.
Package strings contains helper functions related to string management.

Jump to

Keyboard shortcuts

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