Open-source multiplayer game server compatible with the RuneScape client https://www.openrs2.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
openrs2/db/src/main/java/dev/openrs2/db/Transaction.kt

23 lines
778 B

package dev.openrs2.db
import java.sql.Connection
/**
* A functional interface representing a single database transation.
* @param T the result type. Use [Unit] if the transaction does not return a
* result.
*/
public fun interface Transaction<T> {
/**
* Executes the transaction on the given [connection]. It is not necessary
* to implement commit or rollback logic yourself.
*
* The transaction may be called multiple times if a deadlock occurs, so
* care needs to be taken if the transaction has any application-level side
* effects.
* @param connection the database connection, which is only valid for the
* duration of the transaction.
* @return the result.
*/
public fun execute(connection: Connection): T
}