cnc-gokit

module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0

README

CNC-GoKit

This is a set of functions used by the CNC across different Go-based applications.

Please note that some convenience functions log warnings and errors via zerolog.

For a documentation please see https://pkg.go.dev/github.com/czcorpus/cnc-gokit

Available packages

collections
  • BinTree
  • CircularList
  • ConcurrentMap
  • MultiDict
  • Set
datetime
  • mostly ISO 8601 related functions
fs

The fs package contains miscellaneous functions for dealing with filesystems (obtaining file information, testing existence,...).

httpclient
  • New(opts...)
influx

The influx serves as a wrapper for the InfluxDB client v2 offering a convenient way of storing data in an InfluxDB database.

  • func ConnectAPI(conf *ConnectionConf, errListen <-chan error) *InfluxDBAdapter
  • func RunWriteConsumerSync[T Influxable](db *InfluxDBAdapter, measurement string, incomingData <-chan T)
logging

The logging package contains functions for a service logging setup based on ZeroLog.

  • type LogLevel string
  • func SetupLogging(path string, level LogLevel)
  • func GinMiddleware() gin.HandlerFunc
mail

The mail package contains functions for sending e-mails with simplicity in mind. TLS and authentication is supported.

maths

The maths package contains few useful functions for working with numbers (Max, Min, RoundToN) and statistics (OnlineMean)

strnum

The strnum package contains functions for converting between numbers, slices of numbers etc. to strings (and in reverse).

strutil

String utilities.

  • func SmartTruncate(inStr string, maxSize int) string
unireq

The unireq package contains helper functions for working with an HTTP request.

  • func CheckSuperfluousURLArgs(req *http.Request, allowedArgs []string)
  • func ClientIP(req *http.Request) net.IP
uniresp

The uniresp package contains functions usable for writing HTTP JSON responses.

util
  • Max
  • Min

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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