mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 14:19:54 +05:00
Remove pathPrfx from fwvDP
This commit is contained in:
@@ -28,17 +28,15 @@ import (
|
||||
)
|
||||
|
||||
// NewfwvProvider constructs a DataProvider
|
||||
func NewFWVProvider(record, pathPrfx string) (dP DataProvider) {
|
||||
dP = &FWVProvider{req: record, cache: NewNavigableMap(nil), pathPrfx: pathPrfx}
|
||||
func NewFWVProvider(record string) (dP DataProvider) {
|
||||
dP = &FWVProvider{req: record, cache: NewNavigableMap(nil)}
|
||||
return
|
||||
}
|
||||
|
||||
// fwvProvider implements engine.DataProvider so we can pass it to filters
|
||||
type FWVProvider struct {
|
||||
req string
|
||||
cache *NavigableMap
|
||||
pathPrfx string // if this comes in path it will be ignored
|
||||
// pathPrfx should be reviewed once the cdrc is removed
|
||||
req string
|
||||
cache *NavigableMap
|
||||
}
|
||||
|
||||
// String is part of engine.DataProvider interface
|
||||
@@ -53,12 +51,6 @@ func (fP *FWVProvider) FieldAsInterface(fldPath []string) (data interface{}, err
|
||||
return
|
||||
}
|
||||
fwvIdx := fldPath[0]
|
||||
if len(fldPath) == 2 {
|
||||
fwvIdx = fldPath[1]
|
||||
}
|
||||
if fP.pathPrfx != utils.EmptyString && (fldPath[0] != fP.pathPrfx || len(fldPath) < 2) {
|
||||
return "", utils.ErrPrefixNotFound(strings.Join(fldPath, utils.NestingSep))
|
||||
}
|
||||
if data, err = fP.cache.FieldAsInterface(fldPath); err == nil ||
|
||||
err != utils.ErrNotFound { // item found in cache
|
||||
return
|
||||
|
||||
@@ -169,7 +169,7 @@ func (rdr *FWVFileER) processFile(fPath, fName string) (err error) {
|
||||
rowNr++ // increment the rowNr after checking if it's not the end of file
|
||||
record := string(buf)
|
||||
agReq := agents.NewAgentRequest(
|
||||
config.NewFWVProvider(record, utils.EmptyString), reqVars,
|
||||
config.NewFWVProvider(record), reqVars,
|
||||
nil, nil, rdr.Config().Tenant,
|
||||
rdr.cgrCfg.GeneralCfg().DefaultTenant,
|
||||
utils.FirstNonEmpty(rdr.Config().Timezone,
|
||||
@@ -251,7 +251,7 @@ func (rdr *FWVFileER) processTrailer(file *os.File, rowNr, evsPosted int, absPat
|
||||
record := string(buf)
|
||||
reqVars := make(map[string]interface{})
|
||||
agReq := agents.NewAgentRequest(
|
||||
config.NewFWVProvider(record, utils.EmptyString), reqVars,
|
||||
config.NewFWVProvider(record), reqVars,
|
||||
nil, nil, rdr.Config().Tenant,
|
||||
rdr.cgrCfg.GeneralCfg().DefaultTenant,
|
||||
utils.FirstNonEmpty(rdr.Config().Timezone,
|
||||
@@ -288,7 +288,7 @@ func (rdr *FWVFileER) processHeader(file *os.File, rowNr, evsPosted int, absPath
|
||||
func (rdr *FWVFileER) createHeaderMap(record string, rowNr, evsPosted int, absPath string) (err error) {
|
||||
reqVars := make(map[string]interface{})
|
||||
agReq := agents.NewAgentRequest(
|
||||
config.NewFWVProvider(record, utils.EmptyString), reqVars,
|
||||
config.NewFWVProvider(record), reqVars,
|
||||
nil, nil, rdr.Config().Tenant,
|
||||
rdr.cgrCfg.GeneralCfg().DefaultTenant,
|
||||
utils.FirstNonEmpty(rdr.Config().Timezone,
|
||||
|
||||
Reference in New Issue
Block a user