MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / JoinStringsMap

Function JoinStringsMap

pkg/util/test/util.go:128–139  ·  view source on GitHub ↗

JoinStringsMap maps contents of xs to strings using f and joins them with sep.

(f func(k any, v any) string, sep string, xs any)

Source from the content-addressed store, hash-verified

126
127// JoinStringsMap maps contents of xs to strings using f and joins them with sep.
128func JoinStringsMap(f func(k any, v any) string, sep string, xs any) string {
129 r, ok := WrapRanger(xs)
130 if !ok {
131 panic(fmt.Sprintf("cannot range over values of type %T", xs))
132 }
133 var ss []string
134 r.Range(func(k, v any) bool {
135 ss = append(ss, f(k, v))
136 return true
137 })
138 return strings.Join(ss, sep)
139}
140
141// JoinStringsf formats contents of xs using format and joins them with sep.
142func JoinStringsf(format, sep string, withKeys bool, xs any) string {

Callers 3

TestDLChannelReqFunction · 0.92
TestNewChannelReqFunction · 0.92
JoinStringsfFunction · 0.85

Calls 3

WrapRangerFunction · 0.85
RangeMethod · 0.65
JoinMethod · 0.65

Tested by 2

TestDLChannelReqFunction · 0.74
TestNewChannelReqFunction · 0.74