Don't call findByPrimaryKeys if ids is empty (#4074)

This commit is contained in:
benthecarman 2022-02-11 06:51:32 -06:00 committed by GitHub
parent bce58ba33d
commit 3991789129
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -42,8 +42,12 @@ abstract class CRUDAction[T, PrimaryKeyType](implicit
protected def findByPrimaryKeysAction(ids: Vector[
PrimaryKeyType]): DBIOAction[Vector[T], NoStream, Effect.Read] = {
findByPrimaryKeys(ids).result
.map(_.toVector)
if (ids.isEmpty) {
DBIO.successful(Vector.empty)
} else {
findByPrimaryKeys(ids).result
.map(_.toVector)
}
}
def findByPrimaryKeyAction(