Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrEmptyConnection indicates that the current connection is not set. // This can happen when the application was initialized with an empty DSN, // or there was an unexpected exception during the switch. ErrEmptyConnection = errors.New("current connection is empty") // ErrUnsupportedDatabaseType indicates that in user-provided configuration // Type field does not correspond to any supported database type. ErrUnsupportedDatabaseType = errors.New("database type not supported") // ErrAliasDoesNotExists indicates that the used alias does not exist in the set of data source connections. ErrAliasDoesNotExists = errors.New("alias does not exists") // ErrIncorrectDefaultAlias indicates that the user-provided default alias has no match in the set of provided data source connections. ErrIncorrectDefaultAlias = errors.New("incorrect default database alias") )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements internal.DataController interface. It provides Switch, List, and Current methods used over a set of data source configurations.
func New ¶
func New(appConfig internal.AppConfig) (c *Controller, err error)
New returns an instance of Controller initiated by the provided configuration.
func (*Controller) Current ¶
func (c *Controller) Current() internal.DataSource
Current returns selected data source connection.
func (*Controller) List ¶
func (c *Controller) List() (result [][]string)
List returns list of data sources available in the application.
func (*Controller) Switch ¶
func (c *Controller) Switch(alias string) (err error)
Switch selects provided data source by its allias and tries to connect to it.
Click to show internal directories.
Click to hide internal directories.