func ConnectDB() *gorm.DB {
	connectionString, driver := createConnectionString()
	db, err := gorm.Open(driver, connectionString)
	if err != nil {
		log.Error(err)
	}
	return db
}
ConnectDB to sql database
package service
import (
	"fmt"
	"github.com/RobyFerro/go-web/config"
	"github.com/jinzhu/gorm"
	_ "github.com/jinzhu/gorm/dialects/mysql"
	"github.com/labstack/gommon/log"
)