Method levelDbStore.saveEvents
has 59 lines of code (exceeds 50 allowed). Consider refactoring.
func (s *levelDbStore) saveEvents(ctx context.Context, expectedStreamSequenceNumber *uint64, streamName string, eventRecords ...*rangedb.EventRecord) (uint64, error) {
if len(eventRecords) < 1 {
return 0, fmt.Errorf("missing events")
}
Method levelDbStore.OptimisticDeleteStream
has 8 return statements (exceeds 4 allowed).
func (s *levelDbStore) OptimisticDeleteStream(ctx context.Context, expectedStreamSequenceNumber uint64, streamName string) error {
select {
case <-ctx.Done():
return context.Canceled
Method levelDbStore.saveEvents
has 7 return statements (exceeds 4 allowed).
func (s *levelDbStore) saveEvents(ctx context.Context, expectedStreamSequenceNumber *uint64, streamName string, eventRecords ...*rangedb.EventRecord) (uint64, error) {
if len(eventRecords) < 1 {
return 0, fmt.Errorf("missing events")
}
Method levelDbStore.saveEvent
has 5 arguments (exceeds 4 allowed). Consider refactoring.
func (s *levelDbStore) saveEvent(ctx context.Context, transaction *leveldb.Transaction, streamName, aggregateType, aggregateID, eventType, eventID string, expectedStreamSequenceNumber *uint64, event, metadata interface{}) ([]byte, uint64, error) {
Method levelDbStore.saveEvent
has 5 return statements (exceeds 4 allowed).
func (s *levelDbStore) saveEvent(ctx context.Context, transaction *leveldb.Transaction, streamName, aggregateType, aggregateID, eventType, eventID string, expectedStreamSequenceNumber *uint64, event, metadata interface{}) ([]byte, uint64, error) {
select {
case <-ctx.Done():
return nil, 0, context.Canceled
Similar blocks of code found in 5 locations. Consider refactoring.
func (s *levelDbStore) AggregateTypesSubscription(ctx context.Context, bufferSize int, subscriber rangedb.RecordSubscriber, aggregateTypes ...string) rangedb.RecordSubscription {
return recordsubscriber.New(
recordsubscriber.AggregateTypesConfig(ctx, s, s.broadcaster, bufferSize,
aggregateTypes,
func(record *rangedb.Record) error {
Similar blocks of code found in 5 locations. Consider refactoring.
func (s *levelDbStore) AllEventsSubscription(ctx context.Context, bufferSize int, subscriber rangedb.RecordSubscriber) rangedb.RecordSubscription {
return recordsubscriber.New(
recordsubscriber.AllEventsConfig(ctx, s, s.broadcaster, bufferSize,
func(record *rangedb.Record) error {
subscriber.Accept(record)
There are no issues that match your filters.