初始化实现

This commit is contained in:
Yun
2026-06-06 02:09:22 +08:00
commit 83c727372a
10 changed files with 670 additions and 0 deletions
@@ -0,0 +1,24 @@
package main
import (
"fmt"
"log"
"code.yun.ink/pkg/mysqlx"
"gorm.io/driver/sqlite"
"gorm.io/gorm/logger"
)
func main() {
client, err := mysqlx.NewDB(
mysqlx.WithDialector(sqlite.Open("file::memory:?cache=shared")),
mysqlx.WithLogger(logger.Default.LogMode(logger.Info)),
)
if err != nil {
log.Fatalf("failed to create mysqlx client with custom dialector: %v", err)
}
defer client.Close()
fmt.Println("MySQL SDK client created with custom Dialector")
_ = client
}