sql

package
v0.4.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 5 Imported by: ? 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

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"`
	// MariaDB specific driver config (uses same structure as MySQL since MariaDB is MySQL-compatible)
	MariaDB *MySQLConfig `json:"mariadb,omitempty" yaml:"mariadb,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"
	DriverMariaDB    Driver = "mariadb"
	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          common.DurationString `json:"timeout,omitempty" yaml:"timeout,omitempty"`
	ReadTimeout      common.DurationString `json:"readTimeout,omitempty" yaml:"readTimeout,omitempty"`
	WriteTimeout     common.DurationString `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 common.DurationString `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 proxy.Proxy[Config]

Proxy is the SQL proxy definition proposed in Perses. In case you are defining a datasource that will work with the Perses backend, then you will need to use this definition.

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