Documentation ¶
Index ¶
- Constants
- Variables
- func Init(resolver ConnResolver)
- type ConnResolver
- type ConnectionCH
- type ConnectionPG
- type Host
- type ManagedConnection
- type MockConnectionResolver
- func (d *MockConnectionResolver) Add(connectionID, folder string, connection any) error
- func (d *MockConnectionResolver) GetCHConnection(ctx context.Context, connectionID string) (conn *ConnectionCH, err error)
- func (d *MockConnectionResolver) GetConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
- func (d *MockConnectionResolver) GetPGConnection(ctx context.Context, connectionID string) (*ConnectionPG, error)
- func (d *MockConnectionResolver) ResolveCHConnection(ctx context.Context, connectionID string) (conn *ConnectionCH, err error)
- func (d *MockConnectionResolver) ResolveClusterOrHosts(ctx context.Context, connectionID string) (string, []string, error)
- func (d *MockConnectionResolver) ResolveConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
- func (d *MockConnectionResolver) ResolveConnectionFolder(ctx context.Context, connectionID string) (string, error)
- func (d *MockConnectionResolver) ResolvePGConnection(ctx context.Context, connectionID string) (conn *ConnectionPG, err error)
- func (d *MockConnectionResolver) ResolveProviderType(ctx context.Context, connectionID string) (abstract.ProviderType, error)
- type ReplicaType
- type Role
- 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 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 { }
func (*ConnectionCH) IsManagedConnection ¶
func (pg *ConnectionCH) IsManagedConnection()
type ConnectionPG ¶
type ConnectionPG struct { Hosts []*Host User string Password model.SecretString Database string HasTLS bool CACertificates string ClusterID string }
func (*ConnectionPG) GetPort ¶
func (pg *ConnectionPG) GetPort(hostName string) uint16
func (*ConnectionPG) HostNames ¶
func (pg *ConnectionPG) HostNames() []string
func (*ConnectionPG) IsManagedConnection ¶
func (pg *ConnectionPG) IsManagedConnection()
func (*ConnectionPG) MasterHost ¶
func (pg *ConnectionPG) MasterHost() *Host
func (*ConnectionPG) Replicas ¶
func (pg *ConnectionPG) Replicas() []*Host
func (*ConnectionPG) SetHosts ¶
func (pg *ConnectionPG) SetHosts(hostNames []string, port int)
type Host ¶
type Host struct { Name string Port int Role Role ReplicaType ReplicaType }
func SimpleHost ¶
type ManagedConnection ¶
type ManagedConnection interface {
IsManagedConnection()
}
type MockConnectionResolver ¶
type MockConnectionResolver struct {
// contains filtered or unexported fields
}
func NewMockConnectionResolver ¶
func NewMockConnectionResolver() *MockConnectionResolver
func (*MockConnectionResolver) Add ¶
func (d *MockConnectionResolver) Add(connectionID, folder string, connection any) error
func (*MockConnectionResolver) GetCHConnection ¶
func (d *MockConnectionResolver) GetCHConnection(ctx context.Context, connectionID string) (conn *ConnectionCH, err error)
func (*MockConnectionResolver) GetConnection ¶
func (d *MockConnectionResolver) GetConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
func (*MockConnectionResolver) GetPGConnection ¶
func (d *MockConnectionResolver) GetPGConnection(ctx context.Context, connectionID string) (*ConnectionPG, error)
func (*MockConnectionResolver) ResolveCHConnection ¶
func (d *MockConnectionResolver) ResolveCHConnection(ctx context.Context, connectionID string) (conn *ConnectionCH, err error)
func (*MockConnectionResolver) ResolveClusterOrHosts ¶
func (*MockConnectionResolver) ResolveConnection ¶
func (d *MockConnectionResolver) ResolveConnection(ctx context.Context, connectionID string, typ abstract.ProviderType) (ManagedConnection, error)
func (*MockConnectionResolver) ResolveConnectionFolder ¶
func (*MockConnectionResolver) ResolvePGConnection ¶
func (d *MockConnectionResolver) ResolvePGConnection(ctx context.Context, connectionID string) (conn *ConnectionPG, err error)
func (*MockConnectionResolver) ResolveProviderType ¶
func (d *MockConnectionResolver) ResolveProviderType(ctx context.Context, connectionID string) (abstract.ProviderType, error)
type ReplicaType ¶
type ReplicaType string
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.