mysql/mysql_open.go

gf · contrib/drivers/mysql/mysql_open.go · go · MIT
database

Creates a MySQL sql.DB connection string from config and opens the connection.

// Source: https://github.com/gogf/gf | License: MIT | Copyright 2017 GoFrame Team https://goframe.org
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.

package mysql

import (
	"database/sql"
	"fmt"
	"net/url"
	"strings"

	"github.com/gogf/gf/v2/database/gdb"
	"github.com/gogf/gf/v2/errors/gcode"
	"github.com/gogf/gf/v2/errors/gerror"
)

// Open creates and returns an underlying sql.DB object for mysql.
// Note that it converts time.Time argument to local timezone in default.
func (d *Driver) Open(config *gdb.ConfigNode) 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key