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
BinTree
CircularList
ConcurrentMap
MultiDict
Set
- mostly ISO 8601 related functions
The fs
package contains miscellaneous functions for dealing with
filesystems (obtaining file information, testing existence,...).
New(opts...)
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)
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
The mail
package contains functions for sending e-mails with simplicity in mind.
TLS and authentication is supported.
The maths
package contains few useful functions for working with
numbers (Max
, Min
, RoundToN
) and statistics (OnlineMean
)
The strnum
package contains functions for converting between numbers, slices of
numbers etc. to strings (and in reverse).
String utilities.
func SmartTruncate(inStr string, maxSize int) string
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
The uniresp
package contains functions usable for writing HTTP JSON responses.
Max
Min