dsn

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToInternalConfig

func ToInternalConfig(dsnConfig *DSNConfig) *config.Config

Types

type DSNConfig

type DSNConfig struct {
	Host                      string            // Hostname
	Port                      int               // Port number
	User                      string            // Username
	Password                  string            // Password
	Autocommit                *bool             // If true, commit() will be executed automatically after each statement. If false, commit() and rollback() must be executed manually. (default: true)
	Encryption                *bool             // Encrypt the database connection via TLS (default: true)
	Compression               *bool             // If true, the WebSocket data frame payload data is compressed. If false, it is not compressed. (default: false)
	ClientName                string            // Client name reported to the database (default: "Go client")
	ClientVersion             string            // Client version reported to the database (default: "")
	FetchSize                 int               // Fetch size for results in KiB (default: 2000 KiB)
	QueryTimeout              int               // QueryTimeout sets the query timeout in seconds. If a query runs longer than the specified time, it will be aborted (default: 0)
	ValidateServerCertificate *bool             // If true, validate the server's TLS certificate (default: true)
	CertificateFingerprint    string            // Expected SHA256 checksum of the server's TLS certificate in Hex format (default: "")
	Schema                    string            // Name of the schema to open during connection (default: "")
	ResultSetMaxRows          int               // Maximum number of result set rows returned (default: 0, means no limit)
	Params                    map[string]string // Connection parameters
	AccessToken               string            // Access token (alternative to username/password)
	RefreshToken              string            // Refresh token (alternative to username/password)
	UrlPath                   string            // If the connection is a Http connection RestApi, this is the path of the query
}

DSNConfig is a data source name for an Exasol database.

func ParseDSN

func ParseDSN(dsn string) (*DSNConfig, error)

ParseDSN parses the given DSN (data source name).

func (*DSNConfig) ToDSN

func (c *DSNConfig) ToDSN() string

ToDSN converts the configuration to a DSN (data source name) that can be used for connecting to an Exasol database.

type DSNConfigBuilder

type DSNConfigBuilder struct {
	Config *DSNConfig
}

DSNConfigBuilder is a builder for DSNConfig objects.

func (*DSNConfigBuilder) Autocommit

func (c *DSNConfigBuilder) Autocommit(enabled bool) *DSNConfigBuilder

Autocommit defines if commit() will be executed automatically after each statement (true) or if commit() and rollback() must be executed manually (false). Default: true.

func (*DSNConfigBuilder) CertificateFingerprint

func (c *DSNConfigBuilder) CertificateFingerprint(fingerprint string) *DSNConfigBuilder

CertificateFingerprint sets the expected SHA256 checksum of the server's TLS certificate in Hex format (default: "").

func (*DSNConfigBuilder) ClientName

func (c *DSNConfigBuilder) ClientName(name string) *DSNConfigBuilder

ClientName sets the client name reported to the database (default: "Go client")

func (*DSNConfigBuilder) ClientVersion

func (c *DSNConfigBuilder) ClientVersion(version string) *DSNConfigBuilder

ClientVersion sets the client version reported to the database (default: "")

func (*DSNConfigBuilder) Compression

func (c *DSNConfigBuilder) Compression(enabled bool) *DSNConfigBuilder

Compression sets the compression flag. If true, the WebSocket data frame payload data is compressed. If false, it is not compressed (default: false).

func (*DSNConfigBuilder) Encryption

func (c *DSNConfigBuilder) Encryption(enabled bool) *DSNConfigBuilder

Encryption defines if the database connection should be encrypted via TLS (default: true). Please note that starting with version 8, Exasol does not support unencrypted connections and connections will fail with the following error:

EGOD-11: execution failed with SQL error code '08004' and message 'Connection exception - Only TLS connections are allowed.'

func (*DSNConfigBuilder) FetchSize

func (c *DSNConfigBuilder) FetchSize(size int) *DSNConfigBuilder

FetchSize sets the fetch size for results in KiB (default: 2000 KiB).

func (*DSNConfigBuilder) Host

func (c *DSNConfigBuilder) Host(host string) *DSNConfigBuilder

Host sets the hostname.

func (*DSNConfigBuilder) Port

func (c *DSNConfigBuilder) Port(port int) *DSNConfigBuilder

Port sets the port number.

func (*DSNConfigBuilder) QueryTimeout added in v1.0.1

func (c *DSNConfigBuilder) QueryTimeout(timeout int) *DSNConfigBuilder

QueryTimeout sets the query timeout in seconds. If a query runs longer than the specified time, it will be aborted (default: 0, i.e. no timeout).

func (*DSNConfigBuilder) ResultSetMaxRows

func (c *DSNConfigBuilder) ResultSetMaxRows(maxRows int) *DSNConfigBuilder

ResultSetMaxRows sets the maximum number of result set rows returned (default: 0, means no limit).

func (*DSNConfigBuilder) Schema

func (c *DSNConfigBuilder) Schema(schema string) *DSNConfigBuilder

Schema sets the name of the schema to open during connection (default: "").

func (*DSNConfigBuilder) String

func (c *DSNConfigBuilder) String() string

String converts the configuration to a DSN (data source name) that can be used for connecting to an Exasol database.

func (*DSNConfigBuilder) UrlPath added in v1.0.5

func (c *DSNConfigBuilder) UrlPath(path string) *DSNConfigBuilder

UrlPath sets the URL path for the WebSocket connection. Use this only in special cases.

func (*DSNConfigBuilder) ValidateServerCertificate

func (c *DSNConfigBuilder) ValidateServerCertificate(validate bool) *DSNConfigBuilder

ValidateServerCertificate defines if the driver should validate the server's TLS certificate (default: true).

Jump to

Keyboard shortcuts

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