@groovy.transform.Trait @groovy.transform.CompileStatic trait LogicalDeleteTimestamp<D> extends org.grails.datastore.gorm.GormEntity<D>
Adds soft delete capabilities to a domain class, recording when an entity
was logically deleted in a nullable deletedAt timestamp.
An entity is considered logically deleted when deletedAt is set,
and is excluded from query results by default.
| Type | Name and description |
|---|---|
java.time.Instant |
deletedAt |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static grails.gorm.DetachedCriteria<D> |
createCriteria()Creates a DetachedCriteria instance, excluding soft-deleted records by default. |
|
void |
delete()Marks the entity as logically deleted, setting deletedAt to the current time.
|
|
void |
delete(java.util.Map params)Marks the entity as logically deleted or physically deletes it based on the parameters. |
|
static java.util.List<D> |
findAll(java.util.Map params)Finds all entities, excluding soft-deleted records by default. |
|
static D |
get(java.io.Serializable id)Retrieves an entity by its identifier, excluding soft-deleted records by default. |
|
static java.util.List<D> |
list(java.util.Map params)Lists all entities, excluding soft-deleted records by default. |
|
static D |
load(java.io.Serializable id)Loads an entity by its identifier, excluding soft-deleted records by default. |
|
static D |
proxy(java.io.Serializable id)Proxies an entity by its identifier, excluding soft-deleted records by default. |
|
static D |
read(java.io.Serializable id)Reads an entity by its identifier, excluding soft-deleted records by default. |
|
void |
undelete()Undeletes the entity by clearing deletedAt. |
|
void |
undelete(java.util.Map params)Undeletes the entity by clearing deletedAt with additional parameters. |
|
static java.lang.Object |
withDeleted(groovy.lang.Closure closure)Executes the given closure with soft-deleted records included in queries. |
Creates a DetachedCriteria instance, excluding soft-deleted records by default.
Marks the entity as logically deleted, setting deletedAt to the current time.
An entity that is already logically deleted keeps its original deletion time.
Marks the entity as logically deleted or physically deletes it based on the parameters. An entity that is already logically deleted keeps its original deletion time.
params - The parameters to control saving and deletion behavior.
Use 'hard: true' to physically delete the entity.Finds all entities, excluding soft-deleted records by default.
params - The query parametersRetrieves an entity by its identifier, excluding soft-deleted records by default.
id - The identifier of the entityLists all entities, excluding soft-deleted records by default.
params - The query parametersLoads an entity by its identifier, excluding soft-deleted records by default.
id - The identifier of the entityProxies an entity by its identifier, excluding soft-deleted records by default.
id - The identifier of the entityReads an entity by its identifier, excluding soft-deleted records by default.
id - The identifier of the entity Undeletes the entity by clearing deletedAt.
Undeletes the entity by clearing deletedAt with additional parameters.
params - The parameters for saving the entity.Executes the given closure with soft-deleted records included in queries.
closure - The closure to execute