Your Question
db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{
PrepareStmt: true,
})
gorm 开启 PrepareStmt,会在执行之前多执行一次 Prepare?想问下多执行一次 Prepare 和在 Execute 之前执行的 Prepare 有什么区别,这么做的目的是什么
The document you expected this should be explained
Expected answer
Comment From: demoManito
@jinzhu @a631807682
Comment From: a631807682
PrepareStmt is to support https://pkg.go.dev/database/sql#Conn.PrepareContext But the driver may implement prepare at the time of query, which may cause duplication.
Comment From: demoManito
PrepareStmt is to support pkg.go.dev/database/sql#Conn.PrepareContext But the driver may implement prepare at the time of query, which may cause duplication.
明白了,感谢大佬