save

abstract suspend fun save(context: QueryExecutor, 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

context

The database driver context used to execute the save operation.

entity

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