BREAKING CHANGE: V2 of thr SDK #12
@ -15,6 +15,9 @@ import (
|
|||||||
gormPostgres "gorm.io/driver/postgres"
|
gormPostgres "gorm.io/driver/postgres"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
logger2 "gorm.io/gorm/logger"
|
logger2 "gorm.io/gorm/logger"
|
||||||
|
log2 "log"
|
||||||
|
"os"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed migrations/*.sql
|
//go:embed migrations/*.sql
|
||||||
@ -43,8 +46,15 @@ func (p *postgresqlConnection) Connect(_ context.Context, endpoint string, usern
|
|||||||
|
|
||||||
log.Infof("OtterSpace: migration compleate")
|
log.Infof("OtterSpace: migration compleate")
|
||||||
|
|
||||||
|
dbLogger := logger2.New(log2.New(os.Stdout, "\r\n", log2.LstdFlags), logger2.Config{
|
||||||
|
SlowThreshold: 200 * time.Millisecond,
|
||||||
|
LogLevel: logger2.Warn,
|
||||||
|
IgnoreRecordNotFoundError: true,
|
||||||
|
Colorful: true,
|
||||||
|
})
|
||||||
|
|
||||||
db, err := gorm.Open(gormPostgres.Open(dsn), &gorm.Config{
|
db, err := gorm.Open(gormPostgres.Open(dsn), &gorm.Config{
|
||||||
Logger: logger2.Default.LogMode(logger2.Silent),
|
Logger: dbLogger,
|
||||||
})
|
})
|
||||||
p.db = db
|
p.db = db
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user