gext extends standard go libraries for commonly used programming patterns and utilities
premise implementation and event aggregator
Union merge two maps.If existing map and altered map contains same key than value of existing is replaced by value of altered
union := extensions.Union(existingMap, alteredMap)
reading string from environment variable
env.MustGetStringFlagFromEnv(envLabels)
guardians, panics or throw errors. It is bad practice to panic within library packages, return error instead
err := s.ListenAndServeTLS(certPath, keyPath)
guards.FailOnError(err, "server stopped")
if contentType := r.Header.Get("Content-Type"); contentType != httphead.ContentType.ApplicationJSON {
guards.HttpThrowError(w, http.StatusInternalServerError, "Content-Type=%s, expect application/json", contentType)
return
}
package main
import "github.com/kuritka/gext/log"
var logger = log.Log
func main(){
logger.Panic().Msg("panic!")
}
{"level":"panic","time":"2020-03-02T16:29:20+01:00","caller":"/home/michal/go/src/gext/main.go:8","message":"panic!"}
Used for parsing basic types values
.ToString()
.ToFloat64()
.ToInt()
...
Random numbers and guids
Currently modifying structures. Add items to slices etc..