func (c *Config) FormatDSN() (string, error) {
	serverURL, err := url.Parse(c.ServerURI)
	if err != nil {
		return "", err
	}
	var sessionkv []string
	if c.SessionProperties != nil {
		for k, v := range c.SessionProperties {
			sessionkv = append(sessionkv, k+"="+v)
		}
	}
	var credkv []string
	if c.ExtraCredentials != nil {
		for k, v := range c.ExtraCredentials {
			credkv = append(credkv, k+"="+v)
		}
	}
	source := c.Source
	if source == "" {
		source = "trino-go-client"
	}
	query := make(url.Values)
	query.Add("source", source)
	KerberosEnabled, _ := strconv.ParseBool(c.KerberosEnabled)
	isSSL := serverURL.Scheme == "https"
	if isSSL && c.SSLCertPath != "" {
		query.Add(SSLCertPathConfig, c.SSLCertPath)
	}
	if KerberosEnabled {
		query.Add(KerberosEnabledConfig, "true")
		query.Add(kerberosKeytabPathConfig, c.KerberosKeytabPath)
		query.Add(kerberosPrincipalConfig, c.KerberosPrincipal)
		query.Add(kerberosRealmConfig, c.KerberosRealm)
		query.Add(kerberosConfigPathConfig, c.KerberosConfigPath)
		if !isSSL {
			return "", fmt.Errorf("trino: client configuration error, SSL must be enabled for secure env")
		}
	}
	for k, v := range map[string]string{
		"catalog":            c.Catalog,
		"schema":             c.Schema,
		"session_properties": strings.Join(sessionkv, ","),
		"extra_credentials":  strings.Join(credkv, ","),
		"custom_client":      c.CustomClientName,
	} {
		if v != "" {
			query[k] = []string{v}
		}
	}
	serverURL.RawQuery = query.Encode()
	return serverURL.String(), nil
}
FormatDSN returns a DSN string from the configuration.
package trino
import (
	"context"
	"crypto/tls"
	"crypto/x509"
	"database/sql"
	"database/sql/driver"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"math"
	"net/http"
	"net/url"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"time"
	"unicode"
	"gopkg.in/jcmturner/gokrb5.v6/client"
	"gopkg.in/jcmturner/gokrb5.v6/config"
	"gopkg.in/jcmturner/gokrb5.v6/keytab"
)
func init() {
	sql.Register("trino", &sqldriver{})
}
var (
	DefaultQueryTimeout = 60 * time.Second
	DefaultCancelQueryTimeout = 30 * time.Second
	ErrOperationNotSupported = errors.New("trino: operation not supported")
	ErrQueryCancelled = errors.New("trino: query cancelled")
	ErrUnsupportedHeader = errors.New("trino: server response contains an unsupported header")
)
const (
	preparedStatementHeader    = "X-Trino-Prepared-Statement"
	preparedStatementName      = "_trino_go"
	trinoUserHeader            = "X-Trino-User"
	trinoSourceHeader          = "X-Trino-Source"
	trinoCatalogHeader         = "X-Trino-Catalog"
	trinoSchemaHeader          = "X-Trino-Schema"
	trinoSessionHeader         = "X-Trino-Session"
	trinoSetCatalogHeader      = "X-Trino-Set-Catalog"
	trinoSetSchemaHeader       = "X-Trino-Set-Schema"
	trinoSetPathHeader         = "X-Trino-Set-Path"
	trinoSetSessionHeader      = "X-Trino-Set-Session"
	trinoClearSessionHeader    = "X-Trino-Clear-Session"
	trinoSetRoleHeader         = "X-Trino-Set-Role"
	trinoExtraCredentialHeader = "X-Trino-Extra-Credential"
	KerberosEnabledConfig    = "KerberosEnabled"
	kerberosKeytabPathConfig = "KerberosKeytabPath"
	kerberosPrincipalConfig  = "KerberosPrincipal"
	kerberosRealmConfig      = "KerberosRealm"
	kerberosConfigPathConfig = "KerberosConfigPath"
	SSLCertPathConfig        = "SSLCertPath"
)
var (
	responseToRequestHeaderMap = map[string]string{
		trinoSetSchemaHeader:  trinoSchemaHeader,
		trinoSetCatalogHeader: trinoCatalogHeader,
	}
	unsupportedResponseHeaders = []string{
		trinoSetPathHeader,
		trinoSetSessionHeader,
		trinoClearSessionHeader,
		trinoSetRoleHeader,
	}
)
type sqldriver struct{}
func (d *sqldriver) Open(name string) (driver.Conn, error) {
	return newConn(name)
}
var _ driver.Driver = &sqldriver{}
type Config struct {
	ServerURI          string             
	Source             string             
	Catalog            string             
	Schema             string             
	SessionProperties  map[string]string  
	ExtraCredentials   map[string]string  
	CustomClientName   string             
	KerberosEnabled    string             
	KerberosKeytabPath string             
	KerberosPrincipal  string             
	KerberosRealm      string             
	KerberosConfigPath string             
	SSLCertPath        string             
}