Documentation
¶
Overview ¶
Package connectors contains implements for making connections to relation database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownMode = errors.New("unknown mode")
Functions ¶
This section is empty.
Types ¶
type CockroachDB ¶
type CockroachDB struct {
User string `json:"user" yaml:"user"`
Password string `json:"password" yaml:"password"`
Host string `json:"host" yaml:"host"`
Port int `json:"port" yaml:"port"`
Database string `json:"database" yaml:"database"`
Parameters *CockroachDBParameters `json:"parameters" yaml:"parameters"`
}
CockroachDB config for connecting to cockroachDB.
func (*CockroachDB) DSN ¶
func (c *CockroachDB) DSN() (string, error)
DSN convert struct to DSN and returns connection string.
type CockroachDBOptions ¶
type CockroachDBOptions struct {
Cluster string `json:"cluster" yaml:"cluster"`
Variable CockroachDBVariable `json:"variable" yaml:"variable"`
}
CockroachDBOptions contains options for setting variables and cluster ID.
type CockroachDBParameters ¶
type CockroachDBParameters struct {
ApplicationName string `json:"application_name" yaml:"application_name"`
Mode CockroachSSL `hcl:"mode" json:"mode" yaml:"mode"`
SSLRootCert string `json:"ssl_root_cert" yaml:"ssl_root_cert"`
SSLCert string `json:"ssl_cert" yaml:"ssl_cert"`
SSLKey string `json:"ssl_key" yaml:"ssl_key"`
Options *CockroachDBOptions `json:"options" yaml:"options"`
}
CockroachDBParameters contains url parameters for connecting to database.
type CockroachDBVariable ¶
type CockroachDBVariable struct {
Name string `json:"name" yaml:"name"`
Value string `json:"value" yaml:"value"`
}
CockroachDBVariable sets variable for connections.
type CockroachSSL ¶
type CockroachSSL uint8 //nolint:recvcheck // Mixed receivers are intended (pointer for Unmarshal, value for String)
CockroachSSL is a type for setting connection ssl mode to CockroachDB.
const ( CockroachSSLDisable CockroachSSL // disable CockroachSSLAllow // allow CockroachSSLPrefer // prefer CockroachSSLRequire // require CockroachSSLVerifyCa // verify-ca CockroachSSLVerifyFull // verify-full )
Enum.
func (CockroachSSL) String ¶
func (i CockroachSSL) String() string
func (*CockroachSSL) UnmarshalJSON ¶
func (i *CockroachSSL) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*CockroachSSL) UnmarshalText ¶
func (i *CockroachSSL) UnmarshalText(str []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (*CockroachSSL) UnmarshalYAML ¶
func (i *CockroachSSL) UnmarshalYAML(b *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.
type PostgresDB ¶
type PostgresDB struct {
User string `json:"user" yaml:"user"`
Password string `json:"password" yaml:"password"`
Host string `json:"host" yaml:"host"`
Port int `json:"port" yaml:"port"`
Database string `json:"database" yaml:"database"`
Parameters *PostgresDBParameters `json:"parameters" yaml:"parameters"`
}
PostgresDB config for connecting to postgresDB.
func (*PostgresDB) DSN ¶
func (p *PostgresDB) DSN() (string, error)
DSN convert struct to DSN and returns connection string.
type PostgresDBParameters ¶
type PostgresDBParameters struct {
ApplicationName string `json:"application_name" yaml:"application_name"`
Mode PostgresSSL `json:"mode" yaml:"mode"`
SSLRootCert string `json:"ssl_root_cert" yaml:"ssl_root_cert"`
SSLCert string `json:"ssl_cert" yaml:"ssl_cert"`
SSLKey string `json:"ssl_key" yaml:"ssl_key"`
}
PostgresDBParameters contains url parameters for connecting to database.
type PostgresSSL ¶
type PostgresSSL uint8
PostgresSSL is a type for setting connection ssl mode to PostgresDB.
const ( PostgresSSLDisable PostgresSSL // disable PostgresSSLAllow // allow PostgresSSLPrefer // prefer PostgresSSLRequire // require PostgresSSLVerifyCa // verify-ca PostgresSSLVerifyFull // verify-full )
Enum.
func (PostgresSSL) String ¶
func (i PostgresSSL) String() string
func (*PostgresSSL) UnmarshalJSON ¶
func (i *PostgresSSL) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*PostgresSSL) UnmarshalText ¶
func (i *PostgresSSL) UnmarshalText(str []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (*PostgresSSL) UnmarshalYAML ¶
func (i *PostgresSSL) UnmarshalYAML(b *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler.