2
0

Don't allocate buffer when tx opts are empty

This commit is contained in:
Aliaksandr Mianzhynski
2021-06-23 16:30:39 +03:00
committed by Jack Christensen
parent cabb58cc40
commit 4a2209a1b4
+5
View File
@@ -42,7 +42,12 @@ type TxOptions struct {
DeferrableMode TxDeferrableMode
}
var emptyTxOptions TxOptions
func (txOptions TxOptions) beginSQL() string {
if txOptions == emptyTxOptions {
return "begin"
}
buf := &bytes.Buffer{}
buf.WriteString("begin")
if txOptions.IsoLevel != "" {