feat(log): Working on log library
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Matthieu 'JP' DERASSE
2022-11-26 20:45:32 +00:00
parent 25ce5323a4
commit 5591da9c47
11 changed files with 952 additions and 2 deletions

20
convert/convert.go Normal file
View File

@ -0,0 +1,20 @@
package convert
// ToPointer will convert any type of data to his pointer.
func ToPointer[T any](v T) *T {
return &v
}
// Stringer is a interface that any "enum" style struct need to follow.
type Stringer interface {
String() string
}
// StringerSliceToStringSlice will take a slice of stringer and convert it to a slice of string.
func StringerSliceToStringSlice[E Stringer](v []E) []string {
output := make([]string, len(v))
for i, data := range v {
output[i] = data.String()
}
return output
}