Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kuritka/gext
Package gext is a set of packages that provide many helpers and best practicies to simplify your daily job.
https://github.com/kuritka/gext
Last synced: 24 days ago
JSON representation
Package gext is a set of packages that provide many helpers and best practicies to simplify your daily job.
- Host: GitHub
- URL: https://github.com/kuritka/gext
- Owner: kuritka
- License: mit
- Created: 2020-03-03T17:28:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-03-07T12:19:04.000Z (over 4 years ago)
- Last Synced: 2024-10-05T11:23:26.168Z (about 1 month ago)
- Language: Go
- Size: 16.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.MD
- License: LICENSE
Awesome Lists containing this project
README
# Go Extensions
**gext** extends standard go libraries for commonly used programming patterns and utilities
### concurency
premise implementation and event aggregator### data
#### Union
Union merge two maps.If existing map and altered map contains
same key than value of existing is replaced by value of altered
```go
union := extensions.Union(existingMap, alteredMap)
```### date
### env
reading string from environment variable
```go
env.MustGetStringFlagFromEnv(envLabels)
```### guard
guardians, panics or throw errors. It is bad practice to panic within library packages, return error instead
```go
err := s.ListenAndServeTLS(certPath, keyPath)
guards.FailOnError(err, "server stopped")
``````go
if contentType := r.Header.Get("Content-Type"); contentType != httphead.ContentType.ApplicationJSON {
guards.HttpThrowError(w, http.StatusInternalServerError, "Content-Type=%s, expect application/json", contentType)
return
}
```### httphead
### log
```go
package mainimport "github.com/kuritka/gext/log"
var logger = log.Log
func main(){
logger.Panic().Msg("panic!")
}
``````bash
{"level":"panic","time":"2020-03-02T16:29:20+01:00","caller":"/home/michal/go/src/gext/main.go:8","message":"panic!"}
```### parser
Used for parsing basic types values
```go
.ToString()
.ToFloat64()
.ToInt()
...
```### rand
Random numbers and guids### reflection
Currently modifying structures. Add items to slices etc..