sql

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProxyKindName = "sqlproxy"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Driver Driver `json:"driver" yaml:"driver"`
	// Host is the hostname required to contact the datasource
	Host string `json:"host" yaml:"host"`
	// Database is the database for the datasource
	Database string `json:"database" yaml:"database"`
	// Secret is the name of the secret that should be used for the proxy or discovery configuration
	// It will contain any sensitive information such as username, password, token, certificate.
	Secret string `json:"secret,omitempty" yaml:"secret,omitempty"`
	// MySQL specific driver config
	MySQL *MySQLConfig `json:"mysql,omitempty" yaml:"mysql,omitempty"`
	// Postgres specific driver config
	Postgres *PostgresConfig `json:"postgres,omitempty" yaml:"postgres,omitempty"`
}

func (*Config) UnmarshalJSON

func (s *Config) UnmarshalJSON(data []byte) error

func (*Config) UnmarshalYAML

func (s *Config) UnmarshalYAML(unmarshal func(any) error) error

type Driver

type Driver string

Driver the SQL driver to use

const (
	DriverMySQL      Driver = "mysql"
	DriverPostgreSQL Driver = "postgres"
)

type MySQLConfig

type MySQLConfig struct {
	Params           map[string]string `json:"params,omitempty" yaml:"params,omitempty"`
	MaxAllowedPacket int               `json:"maxAllowedPacket,omitempty" yaml:"maxAllowedPacket,omitempty"`
	Timeout          time.Duration     `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	ReadTimeout      time.Duration     `json:"readTimeout,omitempty" yaml:"readTimeout,omitempty"`
	WriteTimeout     time.Duration     `json:"writeTimeout,omitempty" yaml:"writeTimeout,omitempty"`
}

type PostgresConfig

type PostgresConfig struct {
	// MaxConns is the maximum size of the pool
	MaxConns int32 `json:"maxConns,omitempty" yaml:"maxConns,omitempty"`
	// ConnectTimeout the timeout value used for socket connect operations.
	ConnectTimeout time.Duration `json:"connectTimeout,omitempty" yaml:"connectTimeout,omitempty"`
	// PrepareThreshold specifies the number of PreparedStatement executions that must occur before the driver begins using server-side prepared statements.
	PrepareThreshold *int `json:"prepareThreshold,omitempty" yaml:"prepareThreshold,omitempty"`
	// SSLMode to use when connecting to postgres
	SSLMode SSLMode `json:"sslMode,omitempty" yaml:"sslMode,omitempty"`
	// Options specifies command-line options to send to the server at connection start
	Options string `json:"options,omitempty" yaml:"options,omitempty"`
}

func (*PostgresConfig) UnmarshalJSON

func (p *PostgresConfig) UnmarshalJSON(data []byte) error

func (*PostgresConfig) UnmarshalYAML

func (p *PostgresConfig) UnmarshalYAML(unmarshal func(any) error) error

type Proxy

type Proxy struct {
	Kind string `json:"kind" yaml:"kind"`
	Spec Config `json:"spec" yaml:"spec"`
}

type SSLMode

type SSLMode string

SSLMode postgres ssl modes

const (
	SSLModeDisable    SSLMode = "disable"
	SSLModeAllow      SSLMode = "allow"
	SSLModePreferable SSLMode = "prefer"
	SSLModeRequire    SSLMode = "require"
	SSLModeVerifyFull SSLMode = "verify-full"
	SSLModeVerifyCA   SSLMode = "verify-ca"
)

Jump to

Keyboard shortcuts

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