forked from Silverfish/proton-bridge
14 lines
249 B
Go
14 lines
249 B
Go
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
|
|
}
|