Files
proton-bridge/internal/user/types.go
2022-11-16 12:26:08 +01:00

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
}