Categorygithub.com/etkecc/go-kit
modulepackage
1.5.0
Repository: https://github.com/etkecc/go-kit.git
Documentation: pkg.go.dev

# README

kit - auxilary utilities

  • auxilary functions: Go Reference
  • format subpackage: Go Reference
  • template subpackage: Go Reference
  • workpool subpackage: Go Reference

This is a shared utils package, used by other etke.cc projects. Check godoc for the details

# Packages

package format (markdown) is a markdown to html converter, heavily inspired by the mautrix-go/format package.
Package template provides a handy wrapper around text/template package.
package workpool provides a simple work pool implementation.

# Functions

Chunk slices into chunks.
Eq checks if 2 strings are equal in constant time.
Hash returns sha256 hash of a string.
MapKeys returns map keys only.
MatrixErrorFrom creates a new Matrix error from io.Reader.
MergeMapKeys returns map keys only from multiple maps.
MergeSlices and remove duplicates.
NewErrorResponse creates a new error response.
NewList creates new list.
NewListFrom creates a new list and popupates it from slice.
NewMatrixError creates a new Matrix error.
NewMutex creates a new Mutex instance.
RemoveFromSlice removes elements of toRemove from base slice.
Reverse slice.
SliceToString converts slice of strings into single string (using strings.Join) with optional hook.
StringToInt converts string to int with optional default value.
StringToSlice converts comma-separated string to slice with optional default value.
Truncate truncates a string to a specified length, adding "..." if truncated.
Uniq removes duplicates from slice.
Unquote is a wrapper around strconv.Unquote, but returns original string if unquoting fails.

# Structs

ErrorResponse represents an error response nolint:errname // ErrorResponse is a valid name.
List is unique list, V is used only for AddMapKeys.
MatrixError represents an error response from the Matrix API.
Mutex is a key-based mutex that allows locking and unlocking based on a key.