package main import ( "fmt" "log" "time" "code.yun.ink/pkg/mysqlx" "gorm.io/gorm/logger" "gorm.io/gorm/schema" ) func main() { client, err := mysqlx.NewDB( mysqlx.WithDSN("user:password@tcp(127.0.0.1:3306)/testdb?parseTime=true&loc=Local"), mysqlx.WithLogger(logger.Default.LogMode(logger.Info)), mysqlx.WithNamingStrategy(schema.NamingStrategy{SingularTable: true}), mysqlx.WithDisableForeignKeyConstraintWhenMigrating(true), mysqlx.WithSkipDefaultTransaction(true), mysqlx.WithConnectionPool(5, 20, 15*time.Minute, time.Hour), ) if err != nil { log.Fatalf("failed to create mysqlx client: %v", err) } defer client.Close() fmt.Println("MySQL client created with advanced GORM and connection pool options") _ = client }