Files
Majd Alfhaily 95c3aa6629 Refactor API interfaces (#185)
- Move logging to command level.
- Simplify and unify interfaces for `appstore` package.
- Move sinf replication from "Download" API to "ReplicateSinf" API.
- Handle retries and command specific logic in the command level.
- Rename "Info" API to "AccountInfo".
2023-05-27 18:48:22 +02:00

25 lines
389 B
Go

package util
import "errors"
type Pair[T, U any] struct {
First T
Second U
}
func Zip[T, U any](ts []T, us []U) ([]Pair[T, U], error) {
if len(ts) != len(us) {
return nil, errors.New("slices have different lengths")
}
pairs := make([]Pair[T, U], len(ts))
for i := 0; i < len(ts); i++ {
pairs[i] = Pair[T, U]{
First: ts[i],
Second: us[i],
}
}
return pairs, nil
}