Documentation
¶
Index ¶
- type DatabaseAdapter
- type MySQLAdapter
- func (m *MySQLAdapter) CreateUserCommand(username, password, dbName string) []string
- func (m *MySQLAdapter) DeleteUserCommand(username, dbName string) []string
- func (m *MySQLAdapter) FormatConnectionString(username, password, host, port, dbName string) string
- func (m *MySQLAdapter) GetAliases() []string
- func (m *MySQLAdapter) GetCommandArgs(password string) []string
- func (m *MySQLAdapter) GetConfigFileName() string
- func (m *MySQLAdapter) GetConfigPath() string
- func (m *MySQLAdapter) GetDataPath() string
- func (m *MySQLAdapter) GetDefaultConfig() string
- func (m *MySQLAdapter) GetDefaultPort() string
- func (m *MySQLAdapter) GetEnvVars(dbName, username, password string) []string
- func (m *MySQLAdapter) GetImage(version string) string
- func (m *MySQLAdapter) GetName() string
- func (m *MySQLAdapter) GetVersionCommand() []string
- func (m *MySQLAdapter) ParseVersion(output string) string
- func (m *MySQLAdapter) RotatePasswordCommand(username, newPassword, dbName string) []string
- func (m *MySQLAdapter) SupportsUnauthenticated() bool
- func (m *MySQLAdapter) SupportsUsername() bool
- type PostgresAdapter
- func (p *PostgresAdapter) CreateUserCommand(username, password, dbName string) []string
- func (p *PostgresAdapter) DeleteUserCommand(username, dbName string) []string
- func (p *PostgresAdapter) FormatConnectionString(username, password, host, port, dbName string) string
- func (p *PostgresAdapter) GetAliases() []string
- func (p *PostgresAdapter) GetCommandArgs(password string) []string
- func (p *PostgresAdapter) GetConfigFileName() string
- func (p *PostgresAdapter) GetConfigPath() string
- func (p *PostgresAdapter) GetDataPath() string
- func (p *PostgresAdapter) GetDefaultConfig() string
- func (p *PostgresAdapter) GetDefaultPort() string
- func (p *PostgresAdapter) GetEnvVars(dbName, username, password string) []string
- func (p *PostgresAdapter) GetImage(version string) string
- func (p *PostgresAdapter) GetName() string
- func (p *PostgresAdapter) GetVersionCommand() []string
- func (p *PostgresAdapter) ParseVersion(output string) string
- func (p *PostgresAdapter) RotatePasswordCommand(username, newPassword, dbName string) []string
- func (p *PostgresAdapter) SupportsUnauthenticated() bool
- func (p *PostgresAdapter) SupportsUsername() bool
- type RedisAdapter
- func (r *RedisAdapter) CreateUserCommand(username, password, dbName string) []string
- func (r *RedisAdapter) DeleteUserCommand(username, dbName string) []string
- func (r *RedisAdapter) FormatConnectionString(username, password, host, port, dbName string) string
- func (r *RedisAdapter) GetAliases() []string
- func (r *RedisAdapter) GetCommandArgs(password string) []string
- func (r *RedisAdapter) GetConfigFileName() string
- func (r *RedisAdapter) GetConfigPath() string
- func (r *RedisAdapter) GetDataPath() string
- func (r *RedisAdapter) GetDefaultConfig() string
- func (r *RedisAdapter) GetDefaultPort() string
- func (r *RedisAdapter) GetEnvVars(dbName, username, password string) []string
- func (r *RedisAdapter) GetImage(version string) string
- func (r *RedisAdapter) GetName() string
- func (r *RedisAdapter) GetVersionCommand() []string
- func (r *RedisAdapter) ParseVersion(output string) string
- func (r *RedisAdapter) RotatePasswordCommand(username, newPassword, dbName string) []string
- func (r *RedisAdapter) SupportsUnauthenticated() bool
- func (r *RedisAdapter) SupportsUsername() bool
- type Registry
- func (r *Registry) Get(nameOrAlias string) (DatabaseAdapter, error)
- func (r *Registry) GetAllAliases() map[string]string
- func (r *Registry) IsValidType(dbType string) bool
- func (r *Registry) List() []string
- func (r *Registry) NormalizeType(dbType string) (string, error)
- func (r *Registry) Register(adapter DatabaseAdapter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseAdapter ¶
type DatabaseAdapter interface {
// GetName returns the canonical name of the database (e.g., "postgres", "mysql", "redis")
GetName() string
// GetAliases returns alternative names that map to this database type
GetAliases() []string
// GetImage returns the Docker image for the specified version
GetImage(version string) string
// GetDefaultPort returns the default port for this database
GetDefaultPort() string
// GetEnvVars returns the environment variables needed to configure the container
// Pass empty strings for username and password to run in unauthenticated mode
GetEnvVars(dbName, username, password string) []string
// SupportsUnauthenticated returns whether this database can run without authentication
SupportsUnauthenticated() bool
// GetDataPath returns the path inside the container where data is stored
GetDataPath() string
// GetConfigPath returns the path inside the container where config files are stored
GetConfigPath() string
// GetConfigFileName returns the name of the main configuration file
GetConfigFileName() string
// GetDefaultConfig returns the default configuration file content
GetDefaultConfig() string
// CreateUserCommand returns the command to create a new user in the database
// Returns nil if user creation is not supported
CreateUserCommand(username, password, dbName string) []string
// DeleteUserCommand returns the command to delete a user from the database
// Returns nil if user deletion is not supported
DeleteUserCommand(username, dbName string) []string
// RotatePasswordCommand returns the command to rotate a user's password
// Returns nil if password rotation is not supported
RotatePasswordCommand(username, newPassword, dbName string) []string
// FormatConnectionString returns the connection string for this database
FormatConnectionString(username, password, host, port, dbName string) string
// SupportsUsername returns whether this database supports username authentication
SupportsUsername() bool
// GetCommandArgs returns custom command line arguments for starting the container
// Returns empty slice if no custom command is needed
// Pass empty string for password to run in unauthenticated mode
GetCommandArgs(password string) []string
// GetVersionCommand returns the command to get the database version
// Returns nil if version detection is not supported
GetVersionCommand() []string
// ParseVersion parses the version output from GetVersionCommand
// Returns a clean version string (e.g., "16.1" instead of full output)
ParseVersion(output string) string
}
DatabaseAdapter defines the interface that all database providers must implement
type MySQLAdapter ¶
type MySQLAdapter struct{}
MySQLAdapter implements the DatabaseAdapter interface for MySQL
func NewMySQLAdapter ¶
func NewMySQLAdapter() *MySQLAdapter
func (*MySQLAdapter) CreateUserCommand ¶
func (m *MySQLAdapter) CreateUserCommand(username, password, dbName string) []string
func (*MySQLAdapter) DeleteUserCommand ¶
func (m *MySQLAdapter) DeleteUserCommand(username, dbName string) []string
func (*MySQLAdapter) FormatConnectionString ¶
func (m *MySQLAdapter) FormatConnectionString(username, password, host, port, dbName string) string
func (*MySQLAdapter) GetAliases ¶
func (m *MySQLAdapter) GetAliases() []string
func (*MySQLAdapter) GetCommandArgs ¶
func (m *MySQLAdapter) GetCommandArgs(password string) []string
func (*MySQLAdapter) GetConfigFileName ¶
func (m *MySQLAdapter) GetConfigFileName() string
func (*MySQLAdapter) GetConfigPath ¶
func (m *MySQLAdapter) GetConfigPath() string
func (*MySQLAdapter) GetDataPath ¶
func (m *MySQLAdapter) GetDataPath() string
func (*MySQLAdapter) GetDefaultConfig ¶
func (m *MySQLAdapter) GetDefaultConfig() string
func (*MySQLAdapter) GetDefaultPort ¶
func (m *MySQLAdapter) GetDefaultPort() string
func (*MySQLAdapter) GetEnvVars ¶
func (m *MySQLAdapter) GetEnvVars(dbName, username, password string) []string
func (*MySQLAdapter) GetImage ¶
func (m *MySQLAdapter) GetImage(version string) string
func (*MySQLAdapter) GetName ¶
func (m *MySQLAdapter) GetName() string
func (*MySQLAdapter) GetVersionCommand ¶
func (m *MySQLAdapter) GetVersionCommand() []string
func (*MySQLAdapter) ParseVersion ¶
func (m *MySQLAdapter) ParseVersion(output string) string
func (*MySQLAdapter) RotatePasswordCommand ¶
func (m *MySQLAdapter) RotatePasswordCommand(username, newPassword, dbName string) []string
func (*MySQLAdapter) SupportsUnauthenticated ¶ added in v0.2.1
func (m *MySQLAdapter) SupportsUnauthenticated() bool
func (*MySQLAdapter) SupportsUsername ¶
func (m *MySQLAdapter) SupportsUsername() bool
type PostgresAdapter ¶
type PostgresAdapter struct{}
PostgresAdapter implements the DatabaseAdapter interface for PostgreSQL
func NewPostgresAdapter ¶
func NewPostgresAdapter() *PostgresAdapter
func (*PostgresAdapter) CreateUserCommand ¶
func (p *PostgresAdapter) CreateUserCommand(username, password, dbName string) []string
func (*PostgresAdapter) DeleteUserCommand ¶
func (p *PostgresAdapter) DeleteUserCommand(username, dbName string) []string
func (*PostgresAdapter) FormatConnectionString ¶
func (p *PostgresAdapter) FormatConnectionString(username, password, host, port, dbName string) string
func (*PostgresAdapter) GetAliases ¶
func (p *PostgresAdapter) GetAliases() []string
func (*PostgresAdapter) GetCommandArgs ¶
func (p *PostgresAdapter) GetCommandArgs(password string) []string
func (*PostgresAdapter) GetConfigFileName ¶
func (p *PostgresAdapter) GetConfigFileName() string
func (*PostgresAdapter) GetConfigPath ¶
func (p *PostgresAdapter) GetConfigPath() string
func (*PostgresAdapter) GetDataPath ¶
func (p *PostgresAdapter) GetDataPath() string
func (*PostgresAdapter) GetDefaultConfig ¶
func (p *PostgresAdapter) GetDefaultConfig() string
func (*PostgresAdapter) GetDefaultPort ¶
func (p *PostgresAdapter) GetDefaultPort() string
func (*PostgresAdapter) GetEnvVars ¶
func (p *PostgresAdapter) GetEnvVars(dbName, username, password string) []string
func (*PostgresAdapter) GetImage ¶
func (p *PostgresAdapter) GetImage(version string) string
func (*PostgresAdapter) GetName ¶
func (p *PostgresAdapter) GetName() string
func (*PostgresAdapter) GetVersionCommand ¶
func (p *PostgresAdapter) GetVersionCommand() []string
func (*PostgresAdapter) ParseVersion ¶
func (p *PostgresAdapter) ParseVersion(output string) string
func (*PostgresAdapter) RotatePasswordCommand ¶
func (p *PostgresAdapter) RotatePasswordCommand(username, newPassword, dbName string) []string
func (*PostgresAdapter) SupportsUnauthenticated ¶ added in v0.2.1
func (p *PostgresAdapter) SupportsUnauthenticated() bool
func (*PostgresAdapter) SupportsUsername ¶
func (p *PostgresAdapter) SupportsUsername() bool
type RedisAdapter ¶
type RedisAdapter struct{}
RedisAdapter implements the DatabaseAdapter interface for Redis
func NewRedisAdapter ¶
func NewRedisAdapter() *RedisAdapter
func (*RedisAdapter) CreateUserCommand ¶
func (r *RedisAdapter) CreateUserCommand(username, password, dbName string) []string
func (*RedisAdapter) DeleteUserCommand ¶
func (r *RedisAdapter) DeleteUserCommand(username, dbName string) []string
func (*RedisAdapter) FormatConnectionString ¶
func (r *RedisAdapter) FormatConnectionString(username, password, host, port, dbName string) string
func (*RedisAdapter) GetAliases ¶
func (r *RedisAdapter) GetAliases() []string
func (*RedisAdapter) GetCommandArgs ¶
func (r *RedisAdapter) GetCommandArgs(password string) []string
GetCommandArgs returns the command line arguments to start Redis with password
func (*RedisAdapter) GetConfigFileName ¶
func (r *RedisAdapter) GetConfigFileName() string
func (*RedisAdapter) GetConfigPath ¶
func (r *RedisAdapter) GetConfigPath() string
func (*RedisAdapter) GetDataPath ¶
func (r *RedisAdapter) GetDataPath() string
func (*RedisAdapter) GetDefaultConfig ¶
func (r *RedisAdapter) GetDefaultConfig() string
func (*RedisAdapter) GetDefaultPort ¶
func (r *RedisAdapter) GetDefaultPort() string
func (*RedisAdapter) GetEnvVars ¶
func (r *RedisAdapter) GetEnvVars(dbName, username, password string) []string
func (*RedisAdapter) GetImage ¶
func (r *RedisAdapter) GetImage(version string) string
func (*RedisAdapter) GetName ¶
func (r *RedisAdapter) GetName() string
func (*RedisAdapter) GetVersionCommand ¶
func (r *RedisAdapter) GetVersionCommand() []string
func (*RedisAdapter) ParseVersion ¶
func (r *RedisAdapter) ParseVersion(output string) string
func (*RedisAdapter) RotatePasswordCommand ¶
func (r *RedisAdapter) RotatePasswordCommand(username, newPassword, dbName string) []string
func (*RedisAdapter) SupportsUnauthenticated ¶ added in v0.2.1
func (r *RedisAdapter) SupportsUnauthenticated() bool
func (*RedisAdapter) SupportsUsername ¶
func (r *RedisAdapter) SupportsUsername() bool
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages all registered database adapters
func (*Registry) Get ¶
func (r *Registry) Get(nameOrAlias string) (DatabaseAdapter, error)
Get retrieves an adapter by name or alias
func (*Registry) GetAllAliases ¶
GetAllAliases returns a map of all aliases to their canonical names
func (*Registry) IsValidType ¶
IsValidType checks if a database type is valid
func (*Registry) NormalizeType ¶
NormalizeType normalizes a database type to its canonical name
func (*Registry) Register ¶
func (r *Registry) Register(adapter DatabaseAdapter)
Register registers a new database adapter