TransactionIsolation helper methods

This commit is contained in:
Aaron Piotrowski 2022-04-11 22:27:36 -05:00
parent 4f5449c828
commit dcbe6ff712
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -8,4 +8,24 @@ enum TransactionIsolation
case Committed;
case Repeatable;
case Serializable;
public function getLabel(): string
{
return match ($this) {
self::Uncommitted => 'Uncommitted',
self::Committed => 'Committed',
self::Repeatable => 'Repeatable',
self::Serializable => 'Serializable',
};
}
public function toSql(): string
{
return match ($this) {
self::Uncommitted => 'READ UNCOMMITTED',
self::Committed => 'READ COMMITTED',
self::Repeatable => 'REPEATABLE READ',
self::Serializable => 'SERIALIZABLE',
};
}
}