Documentation ¶
Index ¶
- func MockNowValue(p TimeProvider) time.Time
- func Register(container *dig.Container) error
- type ItemEventsKafkaReader
- type ItemEventsKafkaReaderDeps
- type ItemEventsKafkaWriter
- type ItemEventsKafkaWriterDeps
- type MockKafkaReader
- func (_m *MockKafkaReader) Close() error
- func (_m *MockKafkaReader) CommitMessages(ctx context.Context, msgs ...kafka.Message) error
- func (_m *MockKafkaReader) EXPECT() *MockKafkaReader_Expecter
- func (_m *MockKafkaReader) FetchMessage(ctx context.Context) (kafka.Message, error)
- func (_m *MockKafkaReader) ReadLastOffset(ctx context.Context) (int64, error)
- func (_m *MockKafkaReader) SetOffset(offset int64) error
- type MockKafkaReader_Close_Call
- type MockKafkaReader_CommitMessages_Call
- func (_c *MockKafkaReader_CommitMessages_Call) Return(_a0 error) *MockKafkaReader_CommitMessages_Call
- func (_c *MockKafkaReader_CommitMessages_Call) Run(run func(ctx context.Context, msgs ...kafka.Message)) *MockKafkaReader_CommitMessages_Call
- func (_c *MockKafkaReader_CommitMessages_Call) RunAndReturn(run func(context.Context, ...kafka.Message) error) *MockKafkaReader_CommitMessages_Call
- type MockKafkaReader_Expecter
- func (_e *MockKafkaReader_Expecter) Close() *MockKafkaReader_Close_Call
- func (_e *MockKafkaReader_Expecter) CommitMessages(ctx interface{}, msgs ...interface{}) *MockKafkaReader_CommitMessages_Call
- func (_e *MockKafkaReader_Expecter) FetchMessage(ctx interface{}) *MockKafkaReader_FetchMessage_Call
- func (_e *MockKafkaReader_Expecter) ReadLastOffset(ctx interface{}) *MockKafkaReader_ReadLastOffset_Call
- func (_e *MockKafkaReader_Expecter) SetOffset(offset interface{}) *MockKafkaReader_SetOffset_Call
- type MockKafkaReader_FetchMessage_Call
- func (_c *MockKafkaReader_FetchMessage_Call) Return(_a0 kafka.Message, _a1 error) *MockKafkaReader_FetchMessage_Call
- func (_c *MockKafkaReader_FetchMessage_Call) Run(run func(ctx context.Context)) *MockKafkaReader_FetchMessage_Call
- func (_c *MockKafkaReader_FetchMessage_Call) RunAndReturn(run func(context.Context) (kafka.Message, error)) *MockKafkaReader_FetchMessage_Call
- type MockKafkaReader_ReadLastOffset_Call
- func (_c *MockKafkaReader_ReadLastOffset_Call) Return(_a0 int64, _a1 error) *MockKafkaReader_ReadLastOffset_Call
- func (_c *MockKafkaReader_ReadLastOffset_Call) Run(run func(ctx context.Context)) *MockKafkaReader_ReadLastOffset_Call
- func (_c *MockKafkaReader_ReadLastOffset_Call) RunAndReturn(run func(context.Context) (int64, error)) *MockKafkaReader_ReadLastOffset_Call
- type MockKafkaReader_SetOffset_Call
- func (_c *MockKafkaReader_SetOffset_Call) Return(_a0 error) *MockKafkaReader_SetOffset_Call
- func (_c *MockKafkaReader_SetOffset_Call) Run(run func(offset int64)) *MockKafkaReader_SetOffset_Call
- func (_c *MockKafkaReader_SetOffset_Call) RunAndReturn(run func(int64) error) *MockKafkaReader_SetOffset_Call
- type MockKafkaWriter
- type MockKafkaWriter_Close_Call
- type MockKafkaWriter_Expecter
- type MockKafkaWriter_WriteMessages_Call
- func (_c *MockKafkaWriter_WriteMessages_Call) Return(_a0 error) *MockKafkaWriter_WriteMessages_Call
- func (_c *MockKafkaWriter_WriteMessages_Call) Run(run func(ctx context.Context, msgs ...kafka.Message)) *MockKafkaWriter_WriteMessages_Call
- func (_c *MockKafkaWriter_WriteMessages_Call) RunAndReturn(run func(context.Context, ...kafka.Message) error) *MockKafkaWriter_WriteMessages_Call
- type MockNow
- type ShutdownHooks
- type ShutdownHooksRegistryDeps
- type TimeProvider
- type UUIDGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockNowValue ¶
func MockNowValue(p TimeProvider) time.Time
Types ¶
type ItemEventsKafkaReader ¶
type ItemEventsKafkaReader struct { *kafka.Reader // contains filtered or unexported fields }
func NewItemEventsKafkaReader ¶
func NewItemEventsKafkaReader(deps ItemEventsKafkaReaderDeps) *ItemEventsKafkaReader
func (*ItemEventsKafkaReader) ReadLastOffset ¶
func (r *ItemEventsKafkaReader) ReadLastOffset(ctx context.Context) (int64, error)
ReadLastOffset reads the last offset from the kafka topic. This is going to be an offset for the next message produced.
type ItemEventsKafkaReaderDeps ¶
type ItemEventsKafkaReaderDeps struct { dig.In RootLogger *slog.Logger // config KafkaTopic string `name:"config.kafka.itemEventsTopic"` KafkaAddress string `name:"config.kafka.address"` ReaderMaxWait time.Duration `name:"config.kafka.readerMaxWait"` // services *ShutdownHooks // package internal KafkaLeaderDialer kafkaLeaderDialer }
type ItemEventsKafkaWriter ¶
type ItemEventsKafkaWriter struct {
*kafka.Writer
}
func NewItemEventsKafkaWriter ¶
func NewItemEventsKafkaWriter(deps ItemEventsKafkaWriterDeps) ItemEventsKafkaWriter
func (ItemEventsKafkaWriter) Close ¶
func (w ItemEventsKafkaWriter) Close() error
We may want to remove this once below PR is merged and new version is released: https://github.com/segmentio/kafka-go/pull/1341
type ItemEventsKafkaWriterDeps ¶
type ItemEventsKafkaWriterDeps struct { dig.In RootLogger *slog.Logger // config KafkaTopic string `name:"config.kafka.itemEventsTopic"` KafkaAddress string `name:"config.kafka.address"` KafkaAllowAutoTopicCreation bool `name:"config.kafka.allowAutoTopicCreation"` KafkaWriteTimeout time.Duration `name:"config.kafka.writeTimeout"` KafkaMaxWriteAttempts int `name:"config.kafka.maxWriteAttempts"` // services *ShutdownHooks }
type MockKafkaReader ¶
MockKafkaReader is an autogenerated mock type for the mockKafkaReader type
func NewMockKafkaReader ¶
func NewMockKafkaReader(t interface { mock.TestingT Cleanup(func()) }) *MockKafkaReader
NewMockKafkaReader creates a new instance of MockKafkaReader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockKafkaReader) Close ¶
func (_m *MockKafkaReader) Close() error
Close provides a mock function with given fields:
func (*MockKafkaReader) CommitMessages ¶
CommitMessages provides a mock function with given fields: ctx, msgs
func (*MockKafkaReader) EXPECT ¶
func (_m *MockKafkaReader) EXPECT() *MockKafkaReader_Expecter
func (*MockKafkaReader) FetchMessage ¶
FetchMessage provides a mock function with given fields: ctx
func (*MockKafkaReader) ReadLastOffset ¶
func (_m *MockKafkaReader) ReadLastOffset(ctx context.Context) (int64, error)
ReadLastOffset provides a mock function with given fields: ctx
func (*MockKafkaReader) SetOffset ¶
func (_m *MockKafkaReader) SetOffset(offset int64) error
SetOffset provides a mock function with given fields: offset
type MockKafkaReader_Close_Call ¶
MockKafkaReader_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
func (*MockKafkaReader_Close_Call) Return ¶
func (_c *MockKafkaReader_Close_Call) Return(_a0 error) *MockKafkaReader_Close_Call
func (*MockKafkaReader_Close_Call) Run ¶
func (_c *MockKafkaReader_Close_Call) Run(run func()) *MockKafkaReader_Close_Call
func (*MockKafkaReader_Close_Call) RunAndReturn ¶
func (_c *MockKafkaReader_Close_Call) RunAndReturn(run func() error) *MockKafkaReader_Close_Call
type MockKafkaReader_CommitMessages_Call ¶
MockKafkaReader_CommitMessages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CommitMessages'
func (*MockKafkaReader_CommitMessages_Call) Return ¶
func (_c *MockKafkaReader_CommitMessages_Call) Return(_a0 error) *MockKafkaReader_CommitMessages_Call
func (*MockKafkaReader_CommitMessages_Call) Run ¶
func (_c *MockKafkaReader_CommitMessages_Call) Run(run func(ctx context.Context, msgs ...kafka.Message)) *MockKafkaReader_CommitMessages_Call
func (*MockKafkaReader_CommitMessages_Call) RunAndReturn ¶
func (_c *MockKafkaReader_CommitMessages_Call) RunAndReturn(run func(context.Context, ...kafka.Message) error) *MockKafkaReader_CommitMessages_Call
type MockKafkaReader_Expecter ¶
type MockKafkaReader_Expecter struct {
// contains filtered or unexported fields
}
func (*MockKafkaReader_Expecter) Close ¶
func (_e *MockKafkaReader_Expecter) Close() *MockKafkaReader_Close_Call
Close is a helper method to define mock.On call
func (*MockKafkaReader_Expecter) CommitMessages ¶
func (_e *MockKafkaReader_Expecter) CommitMessages(ctx interface{}, msgs ...interface{}) *MockKafkaReader_CommitMessages_Call
CommitMessages is a helper method to define mock.On call
- ctx context.Context
- msgs ...kafka.Message
func (*MockKafkaReader_Expecter) FetchMessage ¶
func (_e *MockKafkaReader_Expecter) FetchMessage(ctx interface{}) *MockKafkaReader_FetchMessage_Call
FetchMessage is a helper method to define mock.On call
- ctx context.Context
func (*MockKafkaReader_Expecter) ReadLastOffset ¶
func (_e *MockKafkaReader_Expecter) ReadLastOffset(ctx interface{}) *MockKafkaReader_ReadLastOffset_Call
ReadLastOffset is a helper method to define mock.On call
- ctx context.Context
func (*MockKafkaReader_Expecter) SetOffset ¶
func (_e *MockKafkaReader_Expecter) SetOffset(offset interface{}) *MockKafkaReader_SetOffset_Call
SetOffset is a helper method to define mock.On call
- offset int64
type MockKafkaReader_FetchMessage_Call ¶
MockKafkaReader_FetchMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchMessage'
func (*MockKafkaReader_FetchMessage_Call) Return ¶
func (_c *MockKafkaReader_FetchMessage_Call) Return(_a0 kafka.Message, _a1 error) *MockKafkaReader_FetchMessage_Call
func (*MockKafkaReader_FetchMessage_Call) Run ¶
func (_c *MockKafkaReader_FetchMessage_Call) Run(run func(ctx context.Context)) *MockKafkaReader_FetchMessage_Call
func (*MockKafkaReader_FetchMessage_Call) RunAndReturn ¶
func (_c *MockKafkaReader_FetchMessage_Call) RunAndReturn(run func(context.Context) (kafka.Message, error)) *MockKafkaReader_FetchMessage_Call
type MockKafkaReader_ReadLastOffset_Call ¶
MockKafkaReader_ReadLastOffset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadLastOffset'
func (*MockKafkaReader_ReadLastOffset_Call) Return ¶
func (_c *MockKafkaReader_ReadLastOffset_Call) Return(_a0 int64, _a1 error) *MockKafkaReader_ReadLastOffset_Call
func (*MockKafkaReader_ReadLastOffset_Call) Run ¶
func (_c *MockKafkaReader_ReadLastOffset_Call) Run(run func(ctx context.Context)) *MockKafkaReader_ReadLastOffset_Call
func (*MockKafkaReader_ReadLastOffset_Call) RunAndReturn ¶
func (_c *MockKafkaReader_ReadLastOffset_Call) RunAndReturn(run func(context.Context) (int64, error)) *MockKafkaReader_ReadLastOffset_Call
type MockKafkaReader_SetOffset_Call ¶
MockKafkaReader_SetOffset_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetOffset'
func (*MockKafkaReader_SetOffset_Call) Return ¶
func (_c *MockKafkaReader_SetOffset_Call) Return(_a0 error) *MockKafkaReader_SetOffset_Call
func (*MockKafkaReader_SetOffset_Call) Run ¶
func (_c *MockKafkaReader_SetOffset_Call) Run(run func(offset int64)) *MockKafkaReader_SetOffset_Call
func (*MockKafkaReader_SetOffset_Call) RunAndReturn ¶
func (_c *MockKafkaReader_SetOffset_Call) RunAndReturn(run func(int64) error) *MockKafkaReader_SetOffset_Call
type MockKafkaWriter ¶
MockKafkaWriter is an autogenerated mock type for the mockKafkaWriter type
func NewMockKafkaWriter ¶
func NewMockKafkaWriter(t interface { mock.TestingT Cleanup(func()) }) *MockKafkaWriter
NewMockKafkaWriter creates a new instance of MockKafkaWriter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockKafkaWriter) Close ¶
func (_m *MockKafkaWriter) Close() error
Close provides a mock function with given fields:
func (*MockKafkaWriter) EXPECT ¶
func (_m *MockKafkaWriter) EXPECT() *MockKafkaWriter_Expecter
func (*MockKafkaWriter) WriteMessages ¶
WriteMessages provides a mock function with given fields: ctx, msgs
type MockKafkaWriter_Close_Call ¶
MockKafkaWriter_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
func (*MockKafkaWriter_Close_Call) Return ¶
func (_c *MockKafkaWriter_Close_Call) Return(_a0 error) *MockKafkaWriter_Close_Call
func (*MockKafkaWriter_Close_Call) Run ¶
func (_c *MockKafkaWriter_Close_Call) Run(run func()) *MockKafkaWriter_Close_Call
func (*MockKafkaWriter_Close_Call) RunAndReturn ¶
func (_c *MockKafkaWriter_Close_Call) RunAndReturn(run func() error) *MockKafkaWriter_Close_Call
type MockKafkaWriter_Expecter ¶
type MockKafkaWriter_Expecter struct {
// contains filtered or unexported fields
}
func (*MockKafkaWriter_Expecter) Close ¶
func (_e *MockKafkaWriter_Expecter) Close() *MockKafkaWriter_Close_Call
Close is a helper method to define mock.On call
func (*MockKafkaWriter_Expecter) WriteMessages ¶
func (_e *MockKafkaWriter_Expecter) WriteMessages(ctx interface{}, msgs ...interface{}) *MockKafkaWriter_WriteMessages_Call
WriteMessages is a helper method to define mock.On call
- ctx context.Context
- msgs ...kafka.Message
type MockKafkaWriter_WriteMessages_Call ¶
MockKafkaWriter_WriteMessages_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteMessages'
func (*MockKafkaWriter_WriteMessages_Call) Return ¶
func (_c *MockKafkaWriter_WriteMessages_Call) Return(_a0 error) *MockKafkaWriter_WriteMessages_Call
func (*MockKafkaWriter_WriteMessages_Call) Run ¶
func (_c *MockKafkaWriter_WriteMessages_Call) Run(run func(ctx context.Context, msgs ...kafka.Message)) *MockKafkaWriter_WriteMessages_Call
func (*MockKafkaWriter_WriteMessages_Call) RunAndReturn ¶
func (_c *MockKafkaWriter_WriteMessages_Call) RunAndReturn(run func(context.Context, ...kafka.Message) error) *MockKafkaWriter_WriteMessages_Call
type MockNow ¶
type MockNow struct {
// contains filtered or unexported fields
}
func NewMockNow ¶
func NewMockNow() *MockNow
type ShutdownHooks ¶
type ShutdownHooks struct {
// contains filtered or unexported fields
}
func NewShutdownHooks ¶
func NewShutdownHooks(deps ShutdownHooksRegistryDeps) *ShutdownHooks
func NewTestShutdownHooks ¶
func NewTestShutdownHooks() *ShutdownHooks
func (*ShutdownHooks) HasHook ¶
func (h *ShutdownHooks) HasHook(name string, method any) bool
HasHook checks if a shutdown hook with the given name is registered. Typical usage is in tests and must be carefully considered for production scenarios.
func (*ShutdownHooks) PerformShutdown ¶
func (h *ShutdownHooks) PerformShutdown(ctx context.Context) error
func (*ShutdownHooks) Register ¶
func (h *ShutdownHooks) Register(name string, shutdown func(ctx context.Context) error)
func (*ShutdownHooks) RegisterNoCtx ¶
func (h *ShutdownHooks) RegisterNoCtx(name string, shutdown func() error)
type TimeProvider ¶
func NewTimeProvider ¶
func NewTimeProvider() TimeProvider
type UUIDGenerator ¶
type UUIDGenerator func() string
func NewUUIDGenerator ¶
func NewUUIDGenerator() UUIDGenerator