CrudRepository

interface CrudRepository<ID, E : Any>(source)

Generic CRUD repository interface. Provides standard Create, Read, Update, Delete operations.

Parameters

ID

The type of the primary key

E

The entity type

Functions

Link copied to clipboard
abstract fun count(): Int

Count all records.

Link copied to clipboard
fun <ID, E : Any> CrudRepository<ID, E>.delete(entity: E): Boolean

Extension function to delete an entity.

Link copied to clipboard
abstract fun deleteById(id: ID): Boolean

Delete a record by its ID.

Link copied to clipboard
abstract fun existsById(id: ID): Boolean

Check if a record exists with the given ID.

Link copied to clipboard
abstract fun findAll(): List<E>

Find all records.

Link copied to clipboard
abstract fun findById(id: ID): E?

Find a record by its ID.

Link copied to clipboard
abstract fun save(entity: E): E

Save (insert or update) a record.