forked from Silverfish/proton-bridge
GODT-1815: Combined/Split mode
This commit is contained in:
13
internal/user/types.go
Normal file
13
internal/user/types.go
Normal file
@ -0,0 +1,13 @@
|
||||
package user
|
||||
|
||||
import "reflect"
|
||||
|
||||
func mapTo[From, To any](from []From) []To {
|
||||
to := make([]To, 0, len(from))
|
||||
|
||||
for _, from := range from {
|
||||
to = append(to, reflect.ValueOf(from).Convert(reflect.TypeOf(to).Elem()).Interface().(To))
|
||||
}
|
||||
|
||||
return to
|
||||
}
|
||||
Reference in New Issue
Block a user