Commit ef3ab3f5 authored by Alexey Palazhchenko's avatar Alexey Palazhchenko Committed by Daniel Theophanes

database/sql: add String method to IsolationLevel

Fixes #23632

Change-Id: I7197e13df6cf28400a6dd86c110f41129550abb6
Reviewed-on: https://go-review.googlesource.com/92235Reviewed-by: 's avatarDaniel Theophanes <kardianos@gmail.com>
parent 1e05924c
......@@ -24,6 +24,7 @@ import (
"reflect"
"runtime"
"sort"
"strconv"
"sync"
"sync/atomic"
"time"
......@@ -132,6 +133,31 @@ const (
LevelLinearizable
)
func (i IsolationLevel) String() string {
switch i {
case LevelDefault:
return "Default"
case LevelReadUncommitted:
return "Read Uncommitted"
case LevelReadCommitted:
return "Read Committed"
case LevelWriteCommitted:
return "Write Committed"
case LevelRepeatableRead:
return "Repeatable Read"
case LevelSnapshot:
return "Snapshot"
case LevelSerializable:
return "Serializable"
case LevelLinearizable:
return "Linearizable"
default:
return "IsolationLevel(" + strconv.Itoa(int(i)) + ")"
}
}
var _ fmt.Stringer = LevelDefault
// TxOptions holds the transaction options to be used in DB.BeginTx.
type TxOptions struct {
// Isolation is the transaction isolation level.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment