Documentation ¶
Overview ¶
Package connection is a generated GoMock package.
Index ¶
- Constants
- func ErrorFromStdErrorByStatus(err error) errors.Error
- func GetErrorFromProtoException(trailers metadata.MD, stdErr error) errors.Error
- type Configuration
- type ConnectionHandle
- type EndPoint
- type GrpcClient
- type MockConnectionHandle
- type MockConnectionHandleMockRecorder
- type MockGrpcClient
- type MockGrpcClientMockRecorder
- type NodePreference
Constants ¶
const ( SchemeDefaultPort = 2113 SchemaHostsSeparator = "," SchemeName = "esdb" SchemeNameWithDiscover = "esdb+discover" SchemePathSeparator = "/" SchemePortSeparator = ":" SchemeQuerySeparator = "?" SchemeSeparator = "://" SchemeSettingSeparator = "&" SchemeUserInfoSeparator = "@" )
const ( MaximumDiscoveryAttemptCountReached errors.ErrorCode = "MaximumDiscoveryAttemptCountReached" UnableToConnectToSingleNode errors.ErrorCode = "UnableToConnectToSingleNode" )
const EsdbConnectionIsClosed errors.ErrorCode = "EsdbConnectionIsClosed"
const UUIDGeneratingError errors.ErrorCode = "UUIDGeneratingError"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct { // The URI of the EventStoreDB. // Use this when connecting to a single node or when DNS Discovery is set to true. // Example: localhost:2113 Address string // An array of end points used to seed gossip. GossipSeeds []*EndPoint // Disable communicating over a secure channel. DisableTLS bool // Defaults to false. // The NodePreference to use when connecting. NodePreference NodePreference // The username to use for authenticating against the EventStoreDB instance. Username string // The password to use for authenticating against the EventStoreDB instance. Password string // RootCAs defines the set of root certificate authorities // that clients use when verifying server certificates. // If RootCAs is nil, TLS uses the host's root CA set. RootCAs *x509.CertPool // Defaults to nil. // Allows to skip certificate validation. SkipCertificateVerification bool // Defaults to false. // The maximum number of times to attempt end point discovery. MaxDiscoverAttempts int // Defaults to 10. // The polling interval (in milliseconds) used to discover the end point. DiscoveryInterval uint64 // Defaults to 100 milliseconds. // The amount of time (in seconds) after which an attempt to discover gossip will fail. GossipTimeout int // Defaults to 5 seconds. // Specifies if DNS discovery should be used. // If set to true use Address field as DNS address. DnsDiscover bool // Defaults to false. // The amount of time (in milliseconds) to wait after which a keepalive ping is sent on the transport. // If set below 10s, a minimum value of 10s will be used instead. Use -1 to disable. Use -1 to disable. KeepAliveInterval time.Duration // Defaults to 10 seconds. // The amount of time (in milliseconds) the sender of the keep alive ping waits for an acknowledgement. KeepAliveTimeout time.Duration // Defaults to 10 seconds. }
Configuration describes how to connect to an instance of EventStoreDB.
func ParseConnectionString ¶
func ParseConnectionString(connectionString string) (*Configuration, error)
ParseConnectionString creates a Configuration based on an EventStoreDb connection string.
type ConnectionHandle ¶
type ConnectionHandle interface { Id() uuid.UUID Connection() *grpc.ClientConn }
type GrpcClient ¶
type GrpcClient interface { HandleError( handle ConnectionHandle, headers metadata.MD, trailers metadata.MD, err error, mapUnknownErrorToOtherError ...errors.ErrorCode) errors.Error GetConnectionHandle() (ConnectionHandle, errors.Error) Close() }
func NewGrpcClient ¶
func NewGrpcClient(config Configuration) GrpcClient
type MockConnectionHandle ¶
type MockConnectionHandle struct {
// contains filtered or unexported fields
}
MockConnectionHandle is a mock of ConnectionHandle interface.
func NewMockConnectionHandle ¶
func NewMockConnectionHandle(ctrl *gomock.Controller) *MockConnectionHandle
NewMockConnectionHandle creates a new mock instance.
func (*MockConnectionHandle) Connection ¶
func (m *MockConnectionHandle) Connection() *grpc.ClientConn
Connection mocks base method.
func (*MockConnectionHandle) EXPECT ¶
func (m *MockConnectionHandle) EXPECT() *MockConnectionHandleMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConnectionHandle) Id ¶
func (m *MockConnectionHandle) Id() uuid.UUID
Id mocks base method.
type MockConnectionHandleMockRecorder ¶
type MockConnectionHandleMockRecorder struct {
// contains filtered or unexported fields
}
MockConnectionHandleMockRecorder is the mock recorder for MockConnectionHandle.
func (*MockConnectionHandleMockRecorder) Connection ¶
func (mr *MockConnectionHandleMockRecorder) Connection() *gomock.Call
Connection indicates an expected call of Connection.
func (*MockConnectionHandleMockRecorder) Id ¶
func (mr *MockConnectionHandleMockRecorder) Id() *gomock.Call
Id indicates an expected call of Id.
type MockGrpcClient ¶
type MockGrpcClient struct {
// contains filtered or unexported fields
}
MockGrpcClient is a mock of GrpcClient interface.
func NewMockGrpcClient ¶
func NewMockGrpcClient(ctrl *gomock.Controller) *MockGrpcClient
NewMockGrpcClient creates a new mock instance.
func (*MockGrpcClient) EXPECT ¶
func (m *MockGrpcClient) EXPECT() *MockGrpcClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockGrpcClient) GetConnectionHandle ¶
func (m *MockGrpcClient) GetConnectionHandle() (ConnectionHandle, errors.Error)
GetConnectionHandle mocks base method.
func (*MockGrpcClient) HandleError ¶
func (m *MockGrpcClient) HandleError(handle ConnectionHandle, headers, trailers metadata.MD, err error, mapUnknownErrorToOtherError ...errors.ErrorCode) errors.Error
HandleError mocks base method.
type MockGrpcClientMockRecorder ¶
type MockGrpcClientMockRecorder struct {
// contains filtered or unexported fields
}
MockGrpcClientMockRecorder is the mock recorder for MockGrpcClient.
func (*MockGrpcClientMockRecorder) Close ¶
func (mr *MockGrpcClientMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close.
func (*MockGrpcClientMockRecorder) GetConnectionHandle ¶
func (mr *MockGrpcClientMockRecorder) GetConnectionHandle() *gomock.Call
GetConnectionHandle indicates an expected call of GetConnectionHandle.
func (*MockGrpcClientMockRecorder) HandleError ¶
func (mr *MockGrpcClientMockRecorder) HandleError(handle, headers, trailers, err interface{}, mapUnknownErrorToOtherError ...interface{}) *gomock.Call
HandleError indicates an expected call of HandleError.
type NodePreference ¶
type NodePreference string
const ( NodePreference_Leader NodePreference = "Leader" NodePreference_Follower NodePreference = "Follower" NodePreference_ReadOnlyReplica NodePreference = "ReadOnlyReplica" NodePreference_Random NodePreference = "Random" )
func (NodePreference) String ¶
func (nodePreference NodePreference) String() string