diff --git a/README.md b/README.md index acf684c0f..210b764de 100644 --- a/README.md +++ b/README.md @@ -460,12 +460,18 @@ func main() { A custom driver name can be set via build options: `-ldflags '-X "github.com/go-mysql-org/go-mysql/driver.driverName=gomysql"'`. This can be useful when using [GORM](https://gorm.io/docs/connecting_to_the_database.html#Customize-Driver): + ```go -mysql.Config{ - DriverName: "gomysql", - ... -} +import ( + _ "github.com/go-mysql-org/go-mysql/driver" + "gorm.io/driver/mysql" + "gorm.io/gorm" +) +db, err := gorm.Open(mysql.New(mysql.Config{ + DriverName: "gomysql", + DSN: "gorm:gorm@127.0.0.1:3306/test", +})) ``` ### Custom NamedValueChecker