feat(log): Working on log library
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
20
convert/convert.go
Normal file
20
convert/convert.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user