save

context(context: QueryExecutor)
abstract suspend fun save(entity: T): DbResult<T>(source)

Saves the given entity to the data source using the specified driver context.

This method determines whether to perform an insert or update operation based on the entity's state. If the operation is successful, the result will contain the saved entity. In case of failure, the result contains the error details.

Return

A DbResult containing the saved entity of type T if the operation is successful, or an error if the operation fails.

Parameters

entity

The entity of type T to be saved in the data source.