msdsn

package
v0.12.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2022 License: BSD-3-Clause Imports: 12 Imported by: 11

Documentation

Index

Constants

View Source
const (
	EncryptionOff      = 0
	EncryptionRequired = 1
	EncryptionDisabled = 3
)

Variables

This section is empty.

Functions

func SetupTLS

func SetupTLS(certificate string, insecureSkipVerify bool, hostInCertificate string) (*tls.Config, error)

Types

type Config

type Config struct {
	Port       uint64
	Host       string
	Instance   string
	Database   string
	User       string
	Password   string
	Encryption Encryption
	TLSConfig  *tls.Config

	FailOverPartner string
	FailOverPort    uint64

	// If true the TLSConfig servername should use the routed server.
	HostInCertificateProvided bool

	// Read Only intent for application database.
	// NOTE: This does not make queries to most databases read-only.
	ReadOnlyIntent bool

	LogFlags Log

	ServerSPN   string
	Workstation string
	AppName     string

	// If true disables database/sql's automatic retry of queries
	// that start on bad connections.
	DisableRetry bool

	DialTimeout time.Duration // DialTimeout defaults to 15s. Set negative to disable.
	ConnTimeout time.Duration // Use context for timeouts.
	KeepAlive   time.Duration // Leave at default.
	PacketSize  uint16
}

func Parse

func Parse(dsn string) (Config, map[string]string, error)

func (Config) URL

func (p Config) URL() *url.URL

convert connectionParams to url style connection string used mostly for testing

type Encryption

type Encryption int

type Log

type Log uint64
const (
	LogErrors      Log = 1
	LogMessages    Log = 2
	LogRows        Log = 4
	LogSQL         Log = 8
	LogParams      Log = 16
	LogTransaction Log = 32
	LogDebug       Log = 64
	LogRetries     Log = 128
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL