connectors

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package connectors contains implements for making connections to relation database.

Index

Constants

This section is empty.

Variables

View Source
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.

type Raw

type Raw struct {
	Query string `json:"dsn" yaml:"dsn"`
}

Raw config for connecting to cockroachDB.

func (*Raw) DSN

func (r *Raw) DSN() (string, error)

DSN convert struct to DSN and returns connection string.

Jump to

Keyboard shortcuts

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