Add method on ERsCfg to retrieve reader by ID

This commit is contained in:
ionutboangiu
2024-04-02 12:17:43 +03:00
committed by Dan Christian Bogos
parent b9b07dc561
commit b924fc9e0c

View File

@@ -35,6 +35,18 @@ type ERsCfg struct {
PartialCacheTTL time.Duration
}
// ReaderCfg iterates over the Readers slice and returns if it finds any
// reader configuration where the ID is equal to the "ID" parameter. If
// none were found, the method will return nil.
func (erS *ERsCfg) ReaderCfg(ID string) *EventReaderCfg {
for _, rdr := range erS.Readers {
if rdr.ID == ID {
return rdr
}
}
return nil
}
func (erS *ERsCfg) loadFromJSONCfg(jsnCfg *ERsJsonCfg, msgTemplates map[string][]*FCTemplate, sep string, dfltRdrCfg *EventReaderCfg, separator string) (err error) {
if jsnCfg == nil {
return