Documentation ¶
Index ¶
- Constants
- Variables
- func Init(resolver ConnResolver)
- type BaseSQLConnection
- func (b *BaseSQLConnection) GetClusterID() string
- func (b *BaseSQLConnection) GetPort(hostName string) uint16
- func (b *BaseSQLConnection) GetUsername() string
- func (b *BaseSQLConnection) HostNames() []string
- func (b *BaseSQLConnection) MasterHost() *Host
- func (b *BaseSQLConnection) Replicas() []*Host
- func (b *BaseSQLConnection) SetHosts(hostNames []string, port int)
- type ConnResolver
- type ConnectionCH
- type ConnectionMySQL
- type ConnectionPG
- type Host
- type ManagedConnection
- type ReplicaType
- type Role
- type StubConnectionResolver
- type UnimplementedResolver
Constants ¶
View Source
const ( Master = Role("MASTER") Replica = Role("REPLICA") RoleUnknown = Role("REPLICA") )
View Source
const ( ReplicaSync = ReplicaType("SYNC") ReplicaAsync = ReplicaType("ASYNC") ReplicaUndefined = ReplicaType("UNDEFINED") )
Variables ¶
View Source
var UninitializedResolverErr = xerrors.NewSentinel("connection resolver not initialized!")
Functions ¶
func Init ¶
func Init(resolver ConnResolver)
Types ¶
type BaseSQLConnection ¶
type BaseSQLConnection struct { Hosts []*Host User string Password model.SecretString // currently filled with user data, not from db list in managed connection Database string HasTLS bool CACertificates string ClusterID string }
func (*BaseSQLConnection) GetClusterID ¶
func (b *BaseSQLConnection) GetClusterID() string
func (*BaseSQLConnection) GetPort ¶
func (b *BaseSQLConnection) GetPort(hostName string) uint16
func (*BaseSQLConnection) GetUsername ¶
func (b *BaseSQLConnection) GetUsername() string
func (*BaseSQLConnection) HostNames ¶
func (b *BaseSQLConnection) HostNames() []string
func (*BaseSQLConnection) MasterHost ¶
func (b *BaseSQLConnection) MasterHost() *Host
func (*BaseSQLConnection) Replicas ¶
func (b *BaseSQLConnection) Replicas() []*Host
func (*BaseSQLConnection) SetHosts ¶
func (b *BaseSQLConnection) SetHosts(hostNames []string, port int)
type ConnResolver ¶
type ConnResolver interface {
ResolveConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
}
func Resolver ¶
func Resolver() ConnResolver
type ConnectionCH ¶
type ConnectionCH struct { // TODO: add shard params *BaseSQLConnection // field in manage connection with applicable databases, currently used for info only. // in the future we may want to check that DatabaseNames if defined includes Database from user input DatabaseNames []string }
func (*ConnectionCH) GetDatabases ¶
func (ch *ConnectionCH) GetDatabases() []string
type ConnectionMySQL ¶
type ConnectionMySQL struct { *BaseSQLConnection // field in manage connection with applicable databases, currently used for info only. // in the future we may want to check that DatabaseNames if defined includes Database from user input DatabaseNames []string }
func (*ConnectionMySQL) GetDatabases ¶
func (m *ConnectionMySQL) GetDatabases() []string
type ConnectionPG ¶
type ConnectionPG struct { *BaseSQLConnection // field in manage connection with applicable databases, currently used for info only. // in the future we may want to check that DatabaseNames if defined includes Database from user input DatabaseNames []string }
func (*ConnectionPG) GetDatabases ¶
func (pg *ConnectionPG) GetDatabases() []string
type Host ¶
type Host struct { Name string Port int Role Role ReplicaType ReplicaType }
func SimpleHost ¶
type ManagedConnection ¶
type ReplicaType ¶
type ReplicaType string
type StubConnectionResolver ¶
type StubConnectionResolver struct {
ConnectionsByID map[string]ManagedConnection
}
func NewStubConnectionResolver ¶
func NewStubConnectionResolver() *StubConnectionResolver
func (*StubConnectionResolver) Add ¶
func (d *StubConnectionResolver) Add(connectionID string, connection any) error
func (*StubConnectionResolver) ResolveConnection ¶
func (d *StubConnectionResolver) ResolveConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
type UnimplementedResolver ¶
type UnimplementedResolver struct{}
func (UnimplementedResolver) ResolveConnection ¶
func (u UnimplementedResolver) ResolveConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
Click to show internal directories.
Click to hide internal directories.