0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-06-06 20:49:12 +02:00

Small improvements

This commit is contained in:
Lunny Xiao 2024-04-15 14:50:52 +08:00
parent ff9839525b
commit 6dba76e744
No known key found for this signature in database
GPG key ID: C3B7C91B632F738A

View file

@ -859,6 +859,10 @@ func GetUserByID(ctx context.Context, id int64) (*User, error) {
// GetUserByIDs returns the user objects by given IDs if exists.
func GetUserByIDs(ctx context.Context, ids []int64) ([]*User, error) {
if len(ids) <= 0 {
return nil, nil
}
users := make([]*User, 0, len(ids))
err := db.GetEngine(ctx).In("id", ids).
Table("user").