Don't allocate buffer when tx opts are empty
This commit is contained in:
committed by
Jack Christensen
parent
cabb58cc40
commit
4a2209a1b4
@@ -42,7 +42,12 @@ type TxOptions struct {
|
|||||||
DeferrableMode TxDeferrableMode
|
DeferrableMode TxDeferrableMode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var emptyTxOptions TxOptions
|
||||||
|
|
||||||
func (txOptions TxOptions) beginSQL() string {
|
func (txOptions TxOptions) beginSQL() string {
|
||||||
|
if txOptions == emptyTxOptions {
|
||||||
|
return "begin"
|
||||||
|
}
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
buf.WriteString("begin")
|
buf.WriteString("begin")
|
||||||
if txOptions.IsoLevel != "" {
|
if txOptions.IsoLevel != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user