mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-15 18:22:27 +08:00
feat: complete promise Any function
This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/duke-git/lancet/v2/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Promise represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
|
// Promise represents the eventual completion (or failure) of an asynchronous operation and its resulting value.
|
||||||
@@ -267,9 +269,10 @@ func Any[T any](promises ...*Promise[T]) *Promise[T] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
errCombo := errs[0]
|
errCombo := errs[0]
|
||||||
// for _, err := range errs[1:] {
|
for _, err := range errs[1:] {
|
||||||
// errCombo = errors.
|
errCombo = internal.JoinError(err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
reject(errCombo)
|
reject(errCombo)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user