Skip to content

Commit

Permalink
feat: tx
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed Mar 4, 2024
1 parent 1b562c1 commit 351a4ce
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mysql/mysql.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mysql

import (
"database/sql"
"fmt"
"time"

Expand All @@ -10,6 +11,10 @@ import (
"gorm.io/gorm"
)

type Tx interface {
Transaction(fc func(tx *gorm.DB) error, opts ...*sql.TxOptions) (err error)
}

func NewOrm(dsn string) (*gorm.DB, error) {
d := mysql.New(mysql.Config{DriverName: "nrmysql", DSN: dsn, DefaultStringSize: 256})
cfg := &gorm.Config{Logger: logger.NewGormLogger(logger.Log(), 200*time.Millisecond, true)}
Expand Down

0 comments on commit 351a4ce

Please sign in to comment.