You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
191 B
Go
15 lines
191 B
Go
3 years ago
|
package model
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
func withTx(ctx context.Context, conn, tx *gorm.DB) *gorm.DB {
|
||
|
if tx != nil {
|
||
|
return tx
|
||
|
} else {
|
||
|
return conn.WithContext(ctx)
|
||
|
}
|
||
|
}
|