mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added FieldAsInterface for EventCost
This commit is contained in:
committed by
Dan Christian Bogos
parent
2f8b7dc53e
commit
ff5f5f2d21
@@ -497,6 +497,29 @@ const (
|
||||
Accounting = "Accounting"
|
||||
Rating = "Rating"
|
||||
Charges = "Charges"
|
||||
CompressFactor = "CompressFactor"
|
||||
Increments = "Increments"
|
||||
Balance = "Balance"
|
||||
BalanceSummaries = "BalanceSummaries"
|
||||
Type = "Type"
|
||||
YearsFieldName = "Years"
|
||||
MonthsFieldName = "Months"
|
||||
MonthDaysFieldName = "MonthDays"
|
||||
WeekDaysFieldName = "WeekDays"
|
||||
GroupIntervalStart = "GroupIntervalStart"
|
||||
RateIncrement = "RateIncrement"
|
||||
RateUnit = "RateUnit"
|
||||
BalanceUUID = "BalanceUUID"
|
||||
RatingID = "RatingID"
|
||||
ExtraChargeID = "ExtraChargeID"
|
||||
ConnectFee = "ConnectFee"
|
||||
RoundingMethod = "RoundingMethod"
|
||||
RoundingDecimals = "RoundingDecimals"
|
||||
MaxCostStrategy = "MaxCostStrategy"
|
||||
TimingID = "TimingID"
|
||||
RatesID = "RatesID"
|
||||
RatingFiltersID = "RatingFiltersID"
|
||||
AccountingID = "AccountingID"
|
||||
MetaSessionS = "*sessions"
|
||||
MetaDefault = "*default"
|
||||
Error = "Error"
|
||||
|
||||
@@ -892,3 +892,23 @@ func CastRPCErr(err error) error {
|
||||
func RandomInteger(min, max int) int {
|
||||
return math_rand.Intn(max-min) + min
|
||||
}
|
||||
|
||||
// GetPathIndex returns the path and index if index present
|
||||
// path[index]=>path,index
|
||||
// path=>path,nil
|
||||
func GetPathIndex(spath string) (opath string, idx *int) {
|
||||
idxStart := strings.Index(spath, IdxStart)
|
||||
if idxStart == -1 || !strings.HasSuffix(spath, IdxEnd) {
|
||||
return spath, nil
|
||||
}
|
||||
slctr := spath[idxStart+1 : len(spath)-1]
|
||||
opath = spath[:idxStart]
|
||||
// if strings.HasPrefix(slctr, DynamicDataPrefix) {
|
||||
// return
|
||||
// }
|
||||
idxVal, err := strconv.Atoi(slctr)
|
||||
if err != nil {
|
||||
return spath, nil
|
||||
}
|
||||
return opath, &idxVal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user