examples

package
v0.0.0-...-717292c Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomAwsCredentialsProvider

type CustomAwsCredentialsProvider struct{}

func (CustomAwsCredentialsProvider) GetAwsCredentialsProvider

func (c CustomAwsCredentialsProvider) GetAwsCredentialsProvider(hostInfo host_info_util.HostInfo, props map[string]string) (aws.CredentialsProvider, error)

type CustomConnectionProvider

type CustomConnectionProvider struct {
	// contains filtered or unexported fields
}

This is an example implementation of ConnectionProvider.

func (*CustomConnectionProvider) AcceptsStrategy

func (c *CustomConnectionProvider) AcceptsStrategy(strategy string) bool

Adds criteria for which host selection strategies are supported. This implementation returns true if strategy is part of acceptedStrategies.

func (*CustomConnectionProvider) AcceptsUrl

func (c *CustomConnectionProvider) AcceptsUrl(hostInfo host_info_util.HostInfo, props map[string]string) bool

Adds criteria for which hosts and properties are supported by this connection provider. This implementation accepts any values, meaning all connections will connect through this connection provider.

func (*CustomConnectionProvider) Connect

Creates a connection with the database. This implementation passes a dsn to its targetDriver to connect.

func (*CustomConnectionProvider) GetHostInfoByStrategy

func (c *CustomConnectionProvider) GetHostInfoByStrategy(hosts []*host_info_util.HostInfo, role host_info_util.HostRole, strategy string, props map[string]string) (*host_info_util.HostInfo, error)

Selects a host from hosts using the provided strategy. This implementation passes the task to a HostSelector.

func (*CustomConnectionProvider) GetHostSelectorStrategy

func (c *CustomConnectionProvider) GetHostSelectorStrategy(strategy string) (driver_infrastructure.HostSelector, error)

Returns a HostSelector that will select a preferred host from a list of hosts. This implementation will always return the corresponding HostSelector to strategy from acceptedStrategies.

type FirstHostSelector

type FirstHostSelector struct {
}

Additonal customization is possible through a custom HostSelector.

func (*FirstHostSelector) GetHost

Implements a strategy to select a host from a list of hosts. This implementation returns the first host in the list regardless of role or props.

Jump to

Keyboard shortcuts

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