Rename method and updated tpexporter

This commit is contained in:
TeoV
2017-10-24 16:27:57 +03:00
parent 3b880c8c8b
commit 0f000cf42a
10 changed files with 116 additions and 100 deletions

View File

@@ -27,7 +27,7 @@ func (self *ApierV1) SetTPFilter(attrs utils.TPFilter, reply *string) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
if err := self.StorDb.SetTPFilter([]*utils.TPFilter{&attrs}); err != nil {
if err := self.StorDb.SetTPFilters([]*utils.TPFilter{&attrs}); err != nil {
return utils.NewErrServerError(err)
}
*reply = utils.OK
@@ -44,7 +44,7 @@ func (self *ApierV1) GetTPFilter(attr AttrGetTPFilter, reply *utils.TPFilter) er
if missing := utils.MissingStructFields(&attr, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
if filter, err := self.StorDb.GetTPFilter(attr.TPid, attr.ID); err != nil {
if filter, err := self.StorDb.GetTPFilters(attr.TPid, attr.ID); err != nil {
if err.Error() != utils.ErrNotFound.Error() {
err = utils.NewErrServerError(err)
}

View File

@@ -27,7 +27,7 @@ func (self *ApierV1) SetTPThreshold(attr utils.TPThreshold, reply *string) error
if missing := utils.MissingStructFields(&attr, []string{"TPid", "Tenant", "ID"}); len(missing) != 0 {
return utils.NewErrMandatoryIeMissing(missing...)
}
if err := self.StorDb.SetTPThreshold([]*utils.TPThreshold{&attr}); err != nil {
if err := self.StorDb.SetTPThresholds([]*utils.TPThreshold{&attr}); err != nil {
return utils.APIErrorHandler(err)
}
*reply = utils.OK
@@ -45,7 +45,7 @@ func (self *ApierV1) GetTPThreshold(attr AttrGetTPThreshold, reply *utils.TPThre
if missing := utils.MissingStructFields(&attr, []string{"TPid", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
if rls, err := self.StorDb.GetTPThreshold(attr.TPid, attr.ID); err != nil {
if rls, err := self.StorDb.GetTPThresholds(attr.TPid, attr.ID); err != nil {
if err.Error() != utils.ErrNotFound.Error() {
err = utils.NewErrServerError(err)
}

View File

@@ -1,7 +1,9 @@
#Tenant[0],Id[1],FilterIDs[2],ActivationInterval[3],Recurrent[4],MinHits[5],MinSleep[6],Blocker[7],Weight[8],ActionIDs[9],Async[10]
cgrates.org,THD_ACNT_BALANCE_1,FLTR_ACNT_BALANCE_1,2014-07-29T15:00:00Z,true,1,1s,false,10,LOG_WARNING,false
cgrates.org,THD_ACNT_EXPIRED,FLTR_ACNT_EXPIRED,2014-07-29T15:00:00Z,true,1,1s,false,10,LOG_WARNING,false
cgrates.org,THD_STATS_1,FLTR_STATS_1,2014-07-29T15:00:00Z,true,1,1s,false,10,LOG_WARNING,false
cgrates.org,THD_STATS_2,FLTR_STATS_2,2014-07-29T15:00:00Z,true,1,1s,false,10,DISABLE_AND_LOG,false
cgrates.org,THD_STATS_3,FLTR_STATS_3,2014-07-29T15:00:00Z,false,1,1s,false,10,TOPUP_100SMS_DE_MOBILE,false
cgrates.org,THD_RES_1,FLTR_RES_1,2014-07-29T15:00:00Z,true,1,1s,false,10,LOG_WARNING,false
cgrates.org,THD_MLT_LINES,FLTR_RES_1;FLTR_STATS_1;FLTR_STATS_2,2014-07-29T15:00:00Z,true,1,1s,false,10,LOG_WARNING;DISABLE_AND_LOG,false
cgrates.org,THD_MLT_LINES,FLTR_RES_12,,,,,,,ACT6;ACT2;ACT3;ACT4,
cgrates.org,THD_MLT_LINES,,,,,,,,ACT1,
cgrates.org,THD_MLT_LINES2,FLTR_RES_1;FLTR_STATS_1,2014-07-29T15:00:00Z,true,1,1s,false,10,,false
cgrates.org,THD_MLT_LINES2,,,,,,,,ACT1,
cgrates.org,THD_MLT_LINES2,Filter1,,,,,,,,
cgrates.org,THD_MLT_LINES3,FLTR_RES_1;FLTR_STATS_1,2014-07-29T15:00:00Z,true,1,1s,false,10,,false
cgrates.org,THD_MLT_LINES3,,,,,,,,ACT1;ACT2,
1 #Tenant[0] Id[1] FilterIDs[2] ActivationInterval[3] Recurrent[4] MinHits[5] MinSleep[6] Blocker[7] Weight[8] ActionIDs[9] Async[10]
2 cgrates.org THD_ACNT_BALANCE_1 THD_MLT_LINES FLTR_ACNT_BALANCE_1 FLTR_RES_1;FLTR_STATS_1;FLTR_STATS_2 2014-07-29T15:00:00Z true 1 1s false 10 LOG_WARNING LOG_WARNING;DISABLE_AND_LOG false
3 cgrates.org THD_ACNT_EXPIRED THD_MLT_LINES FLTR_ACNT_EXPIRED FLTR_RES_12 2014-07-29T15:00:00Z true 1 1s false 10 LOG_WARNING ACT6;ACT2;ACT3;ACT4 false
4 cgrates.org THD_STATS_1 THD_MLT_LINES FLTR_STATS_1 2014-07-29T15:00:00Z true 1 1s false 10 LOG_WARNING ACT1 false
5 cgrates.org THD_STATS_2 THD_MLT_LINES2 FLTR_STATS_2 FLTR_RES_1;FLTR_STATS_1 2014-07-29T15:00:00Z true 1 1s false 10 DISABLE_AND_LOG false
6 cgrates.org THD_STATS_3 THD_MLT_LINES2 FLTR_STATS_3 2014-07-29T15:00:00Z false 1 1s false 10 TOPUP_100SMS_DE_MOBILE ACT1 false
7 cgrates.org THD_RES_1 THD_MLT_LINES2 FLTR_RES_1 Filter1 2014-07-29T15:00:00Z true 1 1s false 10 LOG_WARNING false
8 cgrates.org THD_MLT_LINES3 FLTR_RES_1;FLTR_STATS_1 2014-07-29T15:00:00Z true 1 1s false 10 false
9 cgrates.org THD_MLT_LINES3 ACT1;ACT2

View File

@@ -649,7 +649,7 @@ func (csvs *CSVStorage) GetTPStats(tpid, id string) ([]*utils.TPStats, error) {
return tpStats.AsTPStats(), nil
}
func (csvs *CSVStorage) GetTPThreshold(tpid, id string) ([]*utils.TPThreshold, error) {
func (csvs *CSVStorage) GetTPThresholds(tpid, id string) ([]*utils.TPThreshold, error) {
csvReader, fp, err := csvs.readerFunc(csvs.thresholdsFn, csvs.sep, getColumnCount(TpThreshold{}))
if err != nil {
//log.Print("Could not load threshold file: ", err)
@@ -677,7 +677,7 @@ func (csvs *CSVStorage) GetTPThreshold(tpid, id string) ([]*utils.TPThreshold, e
return tpThreshold.AsTPThreshold(), nil
}
func (csvs *CSVStorage) GetTPFilter(tpid, id string) ([]*utils.TPFilter, error) {
func (csvs *CSVStorage) GetTPFilters(tpid, id string) ([]*utils.TPFilter, error) {
csvReader, fp, err := csvs.readerFunc(csvs.filterFn, csvs.sep, getColumnCount(TpFilter{}))
if err != nil {
//log.Print("Could not load filter file: ", err)

View File

@@ -173,8 +173,8 @@ type LoadReader interface {
GetTPAccountActions(*utils.TPAccountActions) ([]*utils.TPAccountActions, error)
GetTPResources(string, string) ([]*utils.TPResource, error)
GetTPStats(string, string) ([]*utils.TPStats, error)
GetTPThreshold(string, string) ([]*utils.TPThreshold, error)
GetTPFilter(string, string) ([]*utils.TPFilter, error)
GetTPThresholds(string, string) ([]*utils.TPThreshold, error)
GetTPFilters(string, string) ([]*utils.TPFilter, error)
}
type LoadWriter interface {
@@ -197,8 +197,8 @@ type LoadWriter interface {
SetTPAccountActions([]*utils.TPAccountActions) error
SetTPResources([]*utils.TPResource) error
SetTPStats([]*utils.TPStats) error
SetTPThreshold([]*utils.TPThreshold) error
SetTPFilter([]*utils.TPFilter) error
SetTPThresholds([]*utils.TPThreshold) error
SetTPFilters([]*utils.TPFilter) error
}
// NewMarshaler returns the marshaler type selected by mrshlerStr

View File

@@ -1179,7 +1179,7 @@ func (ms *MongoStorage) SetTPStats(tpSTs []*utils.TPStats) (err error) {
return
}
func (ms *MongoStorage) GetTPThreshold(tpid, id string) ([]*utils.TPThreshold, error) {
func (ms *MongoStorage) GetTPThresholds(tpid, id string) ([]*utils.TPThreshold, error) {
filter := bson.M{
"tpid": tpid,
}
@@ -1196,7 +1196,7 @@ func (ms *MongoStorage) GetTPThreshold(tpid, id string) ([]*utils.TPThreshold, e
return results, err
}
func (ms *MongoStorage) SetTPThreshold(tpTHs []*utils.TPThreshold) (err error) {
func (ms *MongoStorage) SetTPThresholds(tpTHs []*utils.TPThreshold) (err error) {
if len(tpTHs) == 0 {
return
}
@@ -1210,7 +1210,7 @@ func (ms *MongoStorage) SetTPThreshold(tpTHs []*utils.TPThreshold) (err error) {
return
}
func (ms *MongoStorage) GetTPFilter(tpid, id string) ([]*utils.TPFilter, error) {
func (ms *MongoStorage) GetTPFilters(tpid, id string) ([]*utils.TPFilter, error) {
filter := bson.M{
"tpid": tpid,
}
@@ -1227,7 +1227,7 @@ func (ms *MongoStorage) GetTPFilter(tpid, id string) ([]*utils.TPFilter, error)
return results, err
}
func (ms *MongoStorage) SetTPFilter(tpTHs []*utils.TPFilter) (err error) {
func (ms *MongoStorage) SetTPFilters(tpTHs []*utils.TPFilter) (err error) {
if len(tpTHs) == 0 {
return
}

View File

@@ -620,7 +620,7 @@ func (self *SQLStorage) SetTPStats(sts []*utils.TPStats) error {
return nil
}
func (self *SQLStorage) SetTPThreshold(ths []*utils.TPThreshold) error {
func (self *SQLStorage) SetTPThresholds(ths []*utils.TPThreshold) error {
if len(ths) == 0 {
return nil
}
@@ -642,7 +642,7 @@ func (self *SQLStorage) SetTPThreshold(ths []*utils.TPThreshold) error {
return nil
}
func (self *SQLStorage) SetTPFilter(ths []*utils.TPFilter) error {
func (self *SQLStorage) SetTPFilters(ths []*utils.TPFilter) error {
if len(ths) == 0 {
return nil
}
@@ -1610,7 +1610,7 @@ func (self *SQLStorage) GetTPStats(tpid, id string) ([]*utils.TPStats, error) {
return asts, nil
}
func (self *SQLStorage) GetTPThreshold(tpid, id string) ([]*utils.TPThreshold, error) {
func (self *SQLStorage) GetTPThresholds(tpid, id string) ([]*utils.TPThreshold, error) {
var ths TpThresholdS
q := self.db.Where("tpid = ?", tpid)
if len(id) != 0 {
@@ -1626,7 +1626,7 @@ func (self *SQLStorage) GetTPThreshold(tpid, id string) ([]*utils.TPThreshold, e
return aths, nil
}
func (self *SQLStorage) GetTPFilter(tpid, id string) ([]*utils.TPFilter, error) {
func (self *SQLStorage) GetTPFilters(tpid, id string) ([]*utils.TPFilter, error) {
var ths TpFilterS
q := self.db.Where("tpid = ?", tpid)
if len(id) != 0 {

View File

@@ -1659,7 +1659,7 @@ func (tpr *TpReader) LoadStats() error {
}
func (tpr *TpReader) LoadThresholdsFiltered(tag string) error {
tps, err := tpr.lr.GetTPThreshold(tpr.tpid, tag)
tps, err := tpr.lr.GetTPThresholds(tpr.tpid, tag)
if err != nil {
return err
}
@@ -1689,7 +1689,7 @@ func (tpr *TpReader) LoadThresholds() error {
}
func (tpr *TpReader) LoadFilterFiltered(tag string) error {
tps, err := tpr.lr.GetTPFilter(tpr.tpid, tag)
tps, err := tpr.lr.GetTPFilters(tpr.tpid, tag)
if err != nil {
return err
}

View File

@@ -102,50 +102,55 @@ func (self *TPExporter) Run() error {
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.DESTINATIONS_CSV] = make([]interface{}, len(storDataDestinations))
for i, sd := range storDataDestinations {
sdModel := APItoModelDestination(sd)
toExportMap[utils.DESTINATIONS_CSV][i] = sdModel[0]
for _, sd := range storDataDestinations {
sdModels := APItoModelDestination(sd)
for _, sdModel := range sdModels {
toExportMap[utils.DESTINATIONS_CSV] = append(toExportMap[utils.DESTINATIONS_CSV], sdModel)
}
}
storDataRates, err := self.storDb.GetTPRates(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.RATES_CSV] = make([]interface{}, len(storDataRates))
for i, sd := range storDataRates {
sdModel := APItoModelRate(sd)
toExportMap[utils.RATES_CSV][i] = sdModel[0]
for _, sd := range storDataRates {
sdModels := APItoModelRate(sd)
for _, sdModel := range sdModels {
toExportMap[utils.RATES_CSV] = append(toExportMap[utils.RATES_CSV], sdModel)
}
}
storDataDestinationRates, err := self.storDb.GetTPDestinationRates(self.tpID, "", nil)
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.DESTINATION_RATES_CSV] = make([]interface{}, len(storDataDestinationRates))
for i, sd := range storDataDestinationRates {
sdModel := APItoModelDestinationRate(sd)
toExportMap[utils.DESTINATION_RATES_CSV][i] = sdModel[0]
for _, sd := range storDataDestinationRates {
sdModels := APItoModelDestinationRate(sd)
for _, sdModel := range sdModels {
toExportMap[utils.DESTINATION_RATES_CSV] = append(toExportMap[utils.DESTINATION_RATES_CSV], sdModel)
}
}
storDataRatingPlans, err := self.storDb.GetTPRatingPlans(self.tpID, "", nil)
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.RATING_PLANS_CSV] = make([]interface{}, len(storDataRatingPlans))
for i, sd := range storDataRatingPlans {
sdModel := APItoModelRatingPlan(sd)
toExportMap[utils.RATING_PLANS_CSV][i] = sdModel[0]
for _, sd := range storDataRatingPlans {
sdModels := APItoModelRatingPlan(sd)
for _, sdModel := range sdModels {
toExportMap[utils.RATING_PLANS_CSV] = append(toExportMap[utils.RATING_PLANS_CSV], sdModel)
}
}
storDataRatingProfiles, err := self.storDb.GetTPRatingProfiles(&utils.TPRatingProfile{TPid: self.tpID})
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.RATING_PROFILES_CSV] = make([]interface{}, len(storDataRatingProfiles))
for i, sd := range storDataRatingProfiles {
sdModel := APItoModelRatingProfile(sd)
toExportMap[utils.RATING_PROFILES_CSV][i] = sdModel[0]
for _, sd := range storDataRatingProfiles {
sdModels := APItoModelRatingProfile(sd)
for _, sdModel := range sdModels {
toExportMap[utils.RATING_PROFILES_CSV] = append(toExportMap[utils.RATING_PROFILES_CSV], sdModel)
}
}
storDataSharedGroups, err := self.storDb.GetTPSharedGroups(self.tpID, "")
@@ -153,121 +158,130 @@ func (self *TPExporter) Run() error {
return err
}
toExportMap[utils.SHARED_GROUPS_CSV] = make([]interface{}, len(storDataSharedGroups))
for i, sd := range storDataSharedGroups {
sdModel := APItoModelSharedGroup(sd)
toExportMap[utils.SHARED_GROUPS_CSV][i] = sdModel[0]
for _, sd := range storDataSharedGroups {
sdModels := APItoModelSharedGroup(sd)
for _, sdModel := range sdModels {
toExportMap[utils.SHARED_GROUPS_CSV] = append(toExportMap[utils.SHARED_GROUPS_CSV], sdModel)
}
}
storDataActions, err := self.storDb.GetTPActions(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.ACTIONS_CSV] = make([]interface{}, len(storDataActions))
for i, sd := range storDataActions {
sdModel := APItoModelAction(sd)
toExportMap[utils.ACTIONS_CSV][i] = sdModel[0]
for _, sd := range storDataActions {
sdModels := APItoModelAction(sd)
for _, sdModel := range sdModels {
toExportMap[utils.ACTIONS_CSV] = append(toExportMap[utils.ACTIONS_CSV], sdModel)
}
}
storDataActionPlans, err := self.storDb.GetTPActionPlans(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.ACTION_PLANS_CSV] = make([]interface{}, len(storDataActionPlans))
for i, sd := range storDataActionPlans {
sdModel := APItoModelActionPlan(sd)
toExportMap[utils.ACTION_PLANS_CSV][i] = sdModel[0]
for _, sd := range storDataActionPlans {
sdModels := APItoModelActionPlan(sd)
for _, sdModel := range sdModels {
toExportMap[utils.ACTION_PLANS_CSV] = append(toExportMap[utils.ACTION_PLANS_CSV], sdModel)
}
}
storDataActionTriggers, err := self.storDb.GetTPActionTriggers(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.ACTION_TRIGGERS_CSV] = make([]interface{}, len(storDataActionTriggers))
for i, sd := range storDataActionTriggers {
sdModel := APItoModelActionTrigger(sd)
toExportMap[utils.ACTION_TRIGGERS_CSV][i] = sdModel[0]
for _, sd := range storDataActionTriggers {
sdModels := APItoModelActionTrigger(sd)
for _, sdModel := range sdModels {
toExportMap[utils.ACTION_TRIGGERS_CSV] = append(toExportMap[utils.ACTION_TRIGGERS_CSV], sdModel)
}
}
storDataAccountActions, err := self.storDb.GetTPAccountActions(&utils.TPAccountActions{TPid: self.tpID})
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.ACCOUNT_ACTIONS_CSV] = make([]interface{}, len(storDataAccountActions))
for i, sd := range storDataAccountActions {
for _, sd := range storDataAccountActions {
sdModel := APItoModelAccountAction(sd)
toExportMap[utils.ACCOUNT_ACTIONS_CSV][i] = sdModel
toExportMap[utils.ACCOUNT_ACTIONS_CSV] = append(toExportMap[utils.ACCOUNT_ACTIONS_CSV], sdModel)
}
storDataDerivedCharges, err := self.storDb.GetTPDerivedChargers(&utils.TPDerivedChargers{TPid: self.tpID})
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.DERIVED_CHARGERS_CSV] = make([]interface{}, len(storDataDerivedCharges))
for i, sd := range storDataDerivedCharges {
sdModel := APItoModelDerivedCharger(sd)
toExportMap[utils.DERIVED_CHARGERS_CSV][i] = sdModel[0]
for _, sd := range storDataDerivedCharges {
sdModels := APItoModelDerivedCharger(sd)
for _, sdModel := range sdModels {
toExportMap[utils.DERIVED_CHARGERS_CSV] = append(toExportMap[utils.DERIVED_CHARGERS_CSV], sdModel)
}
}
storDataCdrStats, err := self.storDb.GetTPCdrStats(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.CDR_STATS_CSV] = make([]interface{}, len(storDataCdrStats))
for i, sd := range storDataCdrStats {
sdModel := APItoModelCdrStat(sd)
toExportMap[utils.CDR_STATS_CSV][i] = sdModel[0]
for _, sd := range storDataCdrStats {
sdModels := APItoModelCdrStat(sd)
for _, sdModel := range sdModels {
toExportMap[utils.CDR_STATS_CSV] = append(toExportMap[utils.CDR_STATS_CSV], sdModel)
}
}
storDataResources, err := self.storDb.GetTPResources(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.ResourcesCsv] = make([]interface{}, len(storDataResources))
for i, sd := range storDataResources {
sdModel := APItoModelResource(sd)
toExportMap[utils.ResourcesCsv][i] = sdModel[0]
for _, sd := range storDataResources {
sdModels := APItoModelResource(sd)
for _, sdModel := range sdModels {
toExportMap[utils.ResourcesCsv] = append(toExportMap[utils.ResourcesCsv], sdModel)
}
}
storDataStats, err := self.storDb.GetTPStats(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.StatsCsv] = make([]interface{}, len(storDataStats))
for i, sd := range storDataStats {
sdModel := APItoModelStats(sd)
toExportMap[utils.StatsCsv][i] = sdModel[0]
for _, sd := range storDataStats {
sdModels := APItoModelStats(sd)
for _, sdModel := range sdModels {
toExportMap[utils.StatsCsv] = append(toExportMap[utils.StatsCsv], sdModel)
}
}
storDataThresholds, err := self.storDb.GetTPThreshold(self.tpID, "")
storDataThresholds, err := self.storDb.GetTPThresholds(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.ThresholdsCsv] = make([]interface{}, len(storDataThresholds))
for i, sd := range storDataThresholds {
sdModel := APItoModelTPThreshold(sd)
toExportMap[utils.ThresholdsCsv][i] = sdModel[0]
for _, sd := range storDataThresholds {
sdModels := APItoModelTPThreshold(sd)
for _, sdModel := range sdModels {
toExportMap[utils.ThresholdsCsv] = append(toExportMap[utils.ThresholdsCsv], sdModel)
}
}
storDataFilters, err := self.storDb.GetTPFilter(self.tpID, "")
storDataFilters, err := self.storDb.GetTPFilters(self.tpID, "")
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.FiltersCsv] = make([]interface{}, len(storDataFilters))
for i, sd := range storDataFilters {
sdModel := APItoModelTPFilter(sd)
toExportMap[utils.FiltersCsv][i] = sdModel[0]
for _, sd := range storDataFilters {
sdModels := APItoModelTPFilter(sd)
for _, sdModel := range sdModels {
toExportMap[utils.FiltersCsv] = append(toExportMap[utils.FiltersCsv], sdModel)
}
}
storDataUsers, err := self.storDb.GetTPUsers(&utils.TPUsers{TPid: self.tpID})
if err != nil && err.Error() != utils.ErrNotFound.Error() {
return err
}
toExportMap[utils.USERS_CSV] = make([]interface{}, len(storDataUsers))
for i, sd := range storDataUsers {
sdModel := APItoModelUsers(sd)
toExportMap[utils.USERS_CSV][i] = sdModel[0]
for _, sd := range storDataUsers {
sdModels := APItoModelUsers(sd)
for _, sdModel := range sdModels {
toExportMap[utils.USERS_CSV] = append(toExportMap[utils.USERS_CSV], sdModel)
}
}
for fileName, storData := range toExportMap {

View File

@@ -380,20 +380,20 @@ func (self *TPCSVImporter) importThresholds(fn string) error {
if self.Verbose {
log.Printf("Processing file: <%s> ", fn)
}
sts, err := self.csvr.GetTPThreshold(self.TPid, "")
sts, err := self.csvr.GetTPThresholds(self.TPid, "")
if err != nil {
return err
}
return self.StorDb.SetTPThreshold(sts)
return self.StorDb.SetTPThresholds(sts)
}
func (self *TPCSVImporter) importFilters(fn string) error {
if self.Verbose {
log.Printf("Processing file: <%s> ", fn)
}
sts, err := self.csvr.GetTPFilter(self.TPid, "")
sts, err := self.csvr.GetTPFilters(self.TPid, "")
if err != nil {
return err
}
return self.StorDb.SetTPFilter(sts)
return self.StorDb.SetTPFilters(sts)
}