Skip to content

Commit 7b16dae

Browse files
committed
Small improvements
1 parent 093e0a3 commit 7b16dae

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

models/user/user.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,10 @@ func GetUserByID(ctx context.Context, id int64) (*User, error) {
856856

857857
// GetUserByIDs returns the user objects by given IDs if exists.
858858
func GetUserByIDs(ctx context.Context, ids []int64) ([]*User, error) {
859+
if len(ids) <= 0 {
860+
return nil, nil
861+
}
862+
859863
users := make([]*User, 0, len(ids))
860864
err := db.GetEngine(ctx).In("id", ids).
861865
Table("user").

0 commit comments

Comments
 (0)