mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: add String method to IsolationLevel
Fixes #23632 Change-Id: I7197e13df6cf28400a6dd86c110f41129550abb6 Reviewed-on: https://go-review.googlesource.com/92235 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
This commit is contained in:
parent
1e05924cf5
commit
ef3ab3f5e2
1 changed files with 26 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue