snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s
Some checks failed
master / ci (push) Failing after 0s
This commit is contained in:
17
internal/name.go
Normal file
17
internal/name.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// StructName returns a normalized name of the passed structure.
|
||||
func StructName(v interface{}) string {
|
||||
if s, ok := v.(fmt.Stringer); ok {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
s := fmt.Sprintf("%T", v)
|
||||
// trim the pointer marker, if any
|
||||
return strings.TrimLeft(s, "*")
|
||||
}
|
||||
Reference in New Issue
Block a user