-
go-sql-driver/mysql
Go MySQL Driver is a MySQL driver for Go's (golang) database/sql package (by go-sql-driver)
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
package models import ( "gorm.io/driver/mysql" "gorm.io/gorm" ) var DB *gorm.DB func ConnectDatabase() { // refer https://github.com/go-sql-driver/mysql#dsn-data-source-name for details dsn := "root:@tcp(127.0.0.1:3309)/fiber-pscale?charset=utf8mb4&parseTime=True&loc=Local" database, err := gorm.Open(mysql.Open(dsn), &gorm.Config{}) if err != nil { panic("failed to connect database") } // Migrate the users table database.AutoMigrate(&User{}) DB = database }
Related posts
-
Question about inserting date into MySQL?
-
Stuck $GOPATH/go.mod exists but should not
-
I Could Not Run a Sample Code to Use MySQL with Go on Docker (Error 1064)
-
Connecting to mysql returns Acces denied. Can only connect to the DB through dbeaver using a specific driver properties configuration.
-
Which SQL driver to use with Postgres