Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Commit a495a54

Browse files
author
Gabriel Mendes
committed
refactor(es-codec): remove unnecessary condition and restructure function return to provide better parameter visualization
1 parent 672edfe commit a495a54

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/elasticsearch/codec.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ func (c basicCodec) getDatabaseIndex(record *models.Record) (string, error) {
5353
indexName = record.Topic
5454
}
5555

56-
indexPrefix := c.config.IndexPrefix
57-
if indexPrefix != "" {
58-
indexName = indexPrefix + indexName
59-
}
60-
6156
indexColumn := c.config.IndexColumn
6257
indexSuffix := record.FormatTimestampDay()
6358
if c.config.TimeSuffix == TimeSuffixHour {
@@ -72,7 +67,11 @@ func (c basicCodec) getDatabaseIndex(record *models.Record) (string, error) {
7267
indexSuffix = newIndexSuffix
7368
}
7469

75-
return fmt.Sprintf("%s-%s", indexName, indexSuffix), nil
70+
return fmt.Sprintf(
71+
"%s%s-%s",
72+
c.config.IndexPrefix,
73+
indexName,
74+
indexSuffix), nil
7675
}
7776

7877
func (c basicCodec) getDatabaseDocID(record *models.Record) (string, error) {

0 commit comments

Comments
 (0)