Documentation ¶
Index ¶
- Constants
- type ConnectionParams
- type Factory
- type KeyValue
- type KeyValues
- type Option
- func WithConnectionTimeout(connectionTimeout int) Option
- func WithFallbackApplicationName(fallbackApplicationName string) Option
- func WithHost(host string) Option
- func WithPassword(password string) Option
- func WithPort(port int) Option
- func WithSSLCert(sslCert string) Option
- func WithSSLKey(sslKey string) Option
- func WithSSLMode(sslMode string) Option
- func WithSSLRootCert(sslRootCert string) Option
- func WithService(service string) Option
- func WithUser(user string) Option
Constants ¶
const ( // No SSL. SSLModeDisable = "disable" // Always SSL (skip verification). SSLModeRequire = "require" // Always SSL (verify that the certificate presented by the server was // signed by a trusted CA) SSLModeVerifyCA = "verify-ca" // Always SSL (verify that the certification presented by the server // was signed by a trusted CA and the server host name matches the one // in the certificate) SSLModeVerifyFull = "verify-full" )
The possible SSL modes.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionParams ¶
type ConnectionParams struct {
// contains filtered or unexported fields
}
func New ¶
func New(dbName string, opts ...Option) ConnectionParams
New constructs a new ConnectionParams for the specified dbName.
func NewWithDefaults ¶
func NewWithDefaults(dbName string, opts ...Option) ConnectionParams
NewWithDefaults returns a ConnectionParams for the specified dbName with default params set.
func (ConnectionParams) DBName ¶
func (p ConnectionParams) DBName() string
func (ConnectionParams) Equal ¶ added in v0.2.0
func (p ConnectionParams) Equal(other ConnectionParams) bool
func (ConnectionParams) KeyValues ¶ added in v0.2.0
func (p ConnectionParams) KeyValues() KeyValues
func (ConnectionParams) String ¶ added in v0.2.0
func (p ConnectionParams) String() string
String returns a string representation of the connection params. Although this can be used as a connection string, it's main purpose is debugging and testing. Either 'p.URI().String()' or 'p.KeyValues().String()' should be used to construct the connection string.
func (ConnectionParams) URI ¶
func (p ConnectionParams) URI() *url.URL
type Factory ¶
type Factory func(dbName string, opts ...Option) ConnectionParams
func DefaultFactory ¶
func DefaultFactory() Factory
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is a parameter to configure the connection.
func WithConnectionTimeout ¶
WithConnectionTimeout returns a Option specifying maximum wait for connection, in seconds. Zero or not specified means wait indefinitely.
func WithFallbackApplicationName ¶
WithFallbackApplicationName returns a Option specifying an application_name to fall back to if one isn't provided.
func WithPassword ¶
WithPassword returns a Option specifying the user's password.
func WithSSLCert ¶
WithSSLCert returns a Option specifying cert file location. The file must contain PEM encoded data.
func WithSSLKey ¶
WithSSLKey returns a Option specifying key file location. The file must contain PEM encoded data.
func WithSSLMode ¶
WithSSLMode returns a Option specifying whether or not to use SSL.
func WithSSLRootCert ¶
WithSSLRootCert returns a Option specifying the location of the root certificate file. The file must contain PEM encoded data
func WithService ¶
WithService returns a Option specifying gSS (Kerberos) service name to use when constructing the SPN.