From 9c16f9da5a20fa1b555f000317f4c1a8fd132fa4 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Fri, 14 Jul 2023 10:35:56 -0400 Subject: [PATCH] Revise syntax for the struct tag values pointed out by go vet --- engine/models.go | 162 +++++++++++++++++++++++------------------------ 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/engine/models.go b/engine/models.go index 69eaafc2a..371b88366 100644 --- a/engine/models.go +++ b/engine/models.go @@ -32,55 +32,55 @@ import ( type TpTiming struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*,\s*"` - Years string `index:"1" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"` - Months string `index:"2" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"` - MonthDays string `index:"3" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"` - WeekDays string `index:"4" re:"\*any\s*,\s*|(?:\d{1,4};?)+\s*,\s*|\s*,\s*"` - Time string `index:"5" re:"\d{2}:\d{2}:\d{2}|\*asap"` + Tag string `index:"0" re:"\\w+\\s*,\\s*"` + Years string `index:"1" re:"\\*any\\s*,\\s*|(?:\\d{1,4};?)+\\s*,\\s*|\\s*,\\s*"` + Months string `index:"2" re:"\\*any\\s*,\\s*|(?:\\d{1,4};?)+\\s*,\\s*|\\s*,\\s*"` + MonthDays string `index:"3" re:"\\*any\\s*,\\s*|(?:\\d{1,4};?)+\\s*,\\s*|\\s*,\\s*"` + WeekDays string `index:"4" re:"\\*any\\s*,\\s*|(?:\\d{1,4};?)+\\s*,\\s*|\\s*,\\s*"` + Time string `index:"5" re:"\\d{2}:\\d{2}:\\d{2}|\\*asap"` CreatedAt time.Time } type TpDestination struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*,\s*"` - Prefix string `index:"1" re:"\+?\d+.?\d*"` + Tag string `index:"0" re:"\\w+\\s*,\\s*"` + Prefix string `index:"1" re:"\\+?\\d+.?\\d*"` CreatedAt time.Time } type TpRate struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*"` - ConnectFee float64 `index:"1" re:"\d+\.*\d*s*"` - Rate float64 `index:"2" re:"\d+\.*\d*s*"` - RateUnit string `index:"3" re:"\d+\.*\d*(ns|us|µs|ms|s|m|h)*\s*"` - RateIncrement string `index:"4" re:"\d+\.*\d*(ns|us|µs|ms|s|m|h)*\s*"` - GroupIntervalStart string `index:"5" re:"\d+\.*\d*(ns|us|µs|ms|s|m|h)*\s*"` + Tag string `index:"0" re:"\\w+\\s*"` + ConnectFee float64 `index:"1" re:"\\d+\\.*\\d*s*"` + Rate float64 `index:"2" re:"\\d+\\.*\\d*s*"` + RateUnit string `index:"3" re:"\\d+\\.*\\d*(ns|us|µs|ms|s|m|h)*\\s*"` + RateIncrement string `index:"4" re:"\\d+\\.*\\d*(ns|us|µs|ms|s|m|h)*\\s*"` + GroupIntervalStart string `index:"5" re:"\\d+\\.*\\d*(ns|us|µs|ms|s|m|h)*\\s*"` CreatedAt time.Time } type TpDestinationRate struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*"` - DestinationsTag string `index:"1" re:"\w+\s*|\*any"` - RatesTag string `index:"2" re:"\w+\s*"` - RoundingMethod string `index:"3" re:"\*up|\*down|\*middle"` - RoundingDecimals int `index:"4" re:"\d+"` - MaxCost float64 `index:"5" re:"\d+\.*\d*s*"` - MaxCostStrategy string `index:"6" re:"\*free|\*disconnect"` + Tag string `index:"0" re:"\\w+\\s*"` + DestinationsTag string `index:"1" re:"\\w+\\s*|\\*any"` + RatesTag string `index:"2" re:"\\w+\\s*"` + RoundingMethod string `index:"3" re:"\\*up|\\*down|\\*middle"` + RoundingDecimals int `index:"4" re:"\\d+"` + MaxCost float64 `index:"5" re:"\\d+\\.*\\d*s*"` + MaxCostStrategy string `index:"6" re:"\\*free|\\*disconnect"` CreatedAt time.Time } type TpRatingPlan struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*,\s*"` - DestratesTag string `index:"1" re:"\w+\s*,\s*|\*any"` - TimingTag string `index:"2" re:"\w+\s*,\s*|\*any"` - Weight float64 `index:"3" re:"\d+.?\d*"` + Tag string `index:"0" re:"\\w+\\s*,\\s*"` + DestratesTag string `index:"1" re:"\\w+\\s*,\\s*|\\*any"` + TimingTag string `index:"2" re:"\\w+\\s*,\\s*|\\*any"` + Weight float64 `index:"3" re:"\\d+.?\\d*"` CreatedAt time.Time } @@ -88,72 +88,72 @@ type TpRatingProfile struct { Id int64 Tpid string Loadid string - Tenant string `index:"0" re:"[0-9A-Za-z_\.]+\s*"` - Category string `index:"1" re:"\w+\s*"` - Subject string `index:"2" re:"\*any\s*|(\w+;?)+\s*"` - ActivationTime string `index:"3" re:"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z"` - RatingPlanTag string `index:"4" re:"\w+\s*"` - FallbackSubjects string `index:"5" re:"\w+\s*"` + Tenant string `index:"0" re:"[0-9A-Za-z_\\.]+\\s*"` + Category string `index:"1" re:"\\w+\\s*"` + Subject string `index:"2" re:"\\*any\\s*|(\\w+;?)+\\s*"` + ActivationTime string `index:"3" re:"\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z"` + RatingPlanTag string `index:"4" re:"\\w+\\s*"` + FallbackSubjects string `index:"5" re:"\\w+\\s*"` CreatedAt time.Time } type TpAction struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*"` - Action string `index:"1" re:"\*\w+\s*"` - ExtraParameters string `index:"2" re:"\S+\s*"` - Filter string `index:"3" re:"\S+\s*"` - BalanceTag string `index:"4" re:"\w+\s*"` - BalanceType string `index:"5" re:"\*\w+\s*"` + Tag string `index:"0" re:"\\w+\\s*"` + Action string `index:"1" re:"\\*\\w+\\s*"` + ExtraParameters string `index:"2" re:"\\S+\\s*"` + Filter string `index:"3" re:"\\S+\\s*"` + BalanceTag string `index:"4" re:"\\w+\\s*"` + BalanceType string `index:"5" re:"\\*\\w+\\s*"` Categories string `index:"6" re:""` - DestinationTags string `index:"7" re:"\*any|\w+\s*"` - RatingSubject string `index:"8" re:"\w+\s*"` + DestinationTags string `index:"7" re:"\\*any|\\w+\\s*"` + RatingSubject string `index:"8" re:"\\w+\\s*"` SharedGroups string `index:"9" re:"[0-9A-Za-z_;]*"` - ExpiryTime string `index:"10" re:"\*\w+\s*|\+\d+[smh]\s*|\d+\s*"` - TimingTags string `index:"11" re:"[0-9A-Za-z_;]*|\*any"` - Units string `index:"12" re:"\d+\s*"` - BalanceWeight string `index:"13" re:"\d+\.?\d*\s*"` + ExpiryTime string `index:"10" re:"\\*\\w+\\s*|\\+\\d+[smh]\\s*|\\d+\\s*"` + TimingTags string `index:"11" re:"[0-9A-Za-z_;]*|\\*any"` + Units string `index:"12" re:"\\d+\\s*"` + BalanceWeight string `index:"13" re:"\\d+\\.?\\d*\\s*"` BalanceBlocker string `index:"14" re:""` BalanceDisabled string `index:"15" re:""` - Weight float64 `index:"16" re:"\d+\.?\d*\s*"` + Weight float64 `index:"16" re:"\\d+\\.?\\d*\\s*"` CreatedAt time.Time } type TpActionPlan struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*,\s*"` - ActionsTag string `index:"1" re:"\w+\s*,\s*"` - TimingTag string `index:"2" re:"\w+\s*,\s*"|\*any` - Weight float64 `index:"3" re:"\d+\.?\d*"` + Tag string `index:"0" re:"\\w+\\s*,\\s*"` + ActionsTag string `index:"1" re:"\\w+\\s*,\\s*"` + TimingTag string `index:"2" re:"\\w+\\s*,\\s*"|\\*any` + Weight float64 `index:"3" re:"\\d+\\.?\\d*"` CreatedAt time.Time } type TpActionTrigger struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+"` - UniqueId string `index:"1" re:"\w+"` - ThresholdType string `index:"2" re:"\*\w+"` - ThresholdValue float64 `index:"3" re:"\d+\.?\d*"` + Tag string `index:"0" re:"\\w+"` + UniqueId string `index:"1" re:"\\w+"` + ThresholdType string `index:"2" re:"\\*\\w+"` + ThresholdValue float64 `index:"3" re:"\\d+\\.?\\d*"` Recurrent bool `index:"4" re:"true|false|"` - MinSleep string `index:"5" re:"\d+[smh]?"` + MinSleep string `index:"5" re:"\\d+[smh]?"` ExpiryTime string `index:"6" re:""` ActivationTime string `index:"7" re:""` - BalanceTag string `index:"8" re:"\w+\s*"` - BalanceType string `index:"9" re:"\*\w+"` + BalanceTag string `index:"8" re:"\\w+\\s*"` + BalanceType string `index:"9" re:"\\*\\w+"` BalanceCategories string `index:"10" re:""` - BalanceDestinationTags string `index:"11" re:"\w+|\*any"` - BalanceRatingSubject string `index:"12" re:"\w+|\*any"` - BalanceSharedGroups string `index:"13" re:"\w+|\*any"` - BalanceExpiryTime string `index:"14" re:"\*\w+\s*|\+\d+[smh]\s*|\d+\s*"` - BalanceTimingTags string `index:"15" re:"[0-9A-Za-z_;]*|\*any"` - BalanceWeight string `index:"16" re:"\d+\.?\d*"` + BalanceDestinationTags string `index:"11" re:"\\w+|\\*any"` + BalanceRatingSubject string `index:"12" re:"\\w+|\\*any"` + BalanceSharedGroups string `index:"13" re:"\\w+|\\*any"` + BalanceExpiryTime string `index:"14" re:"\\*\\w+\\s*|\\+\\d+[smh]\\s*|\\d+\\s*"` + BalanceTimingTags string `index:"15" re:"[0-9A-Za-z_;]*|\\*any"` + BalanceWeight string `index:"16" re:"\\d+\\.?\\d*"` BalanceBlocker string `index:"17" re:""` BalanceDisabled string `index:"18" re:""` - ActionsTag string `index:"19" re:"\w+"` - Weight float64 `index:"20" re:"\d+\.?\d*"` + ActionsTag string `index:"19" re:"\\w+"` + Weight float64 `index:"20" re:"\\d+\\.?\\d*"` CreatedAt time.Time } @@ -161,10 +161,10 @@ type TpAccountAction struct { Id int64 Tpid string Loadid string - Tenant string `index:"0" re:"\w+\s*"` - Account string `index:"1" re:"(\w+;?)+\s*"` - ActionPlanTag string `index:"2" re:"\w+\s*"` - ActionTriggersTag string `index:"3" re:"\w+\s*"` + Tenant string `index:"0" re:"\\w+\\s*"` + Account string `index:"1" re:"(\\w+;?)+\\s*"` + ActionPlanTag string `index:"2" re:"\\w+\\s*"` + ActionTriggersTag string `index:"3" re:"\\w+\\s*"` AllowNegative bool `index:"4" re:""` Disabled bool `index:"5" re:""` CreatedAt time.Time @@ -188,10 +188,10 @@ func (aa *TpAccountAction) GetAccountActionId() string { type TpSharedGroup struct { Id int64 Tpid string - Tag string `index:"0" re:"\w+\s*"` - Account string `index:"1" re:"\*?\w+\s*"` - Strategy string `index:"2" re:"\*\w+\s*"` - RatingSubject string `index:"3" re:"\*?\w]+\s*"` + Tag string `index:"0" re:"\\w+\\s*"` + Account string `index:"1" re:"\\*?\\w+\\s*"` + Strategy string `index:"2" re:"\\*\\w+\\s*"` + RatingSubject string `index:"3" re:"\\*?\\w]+\\s*"` CreatedAt time.Time } @@ -207,7 +207,7 @@ type TpResource struct { AllocationMessage string `index:"6" re:""` Blocker bool `index:"7" re:""` Stored bool `index:"8" re:""` - Weight float64 `index:"9" re:"\d+\.?\d*"` + Weight float64 `index:"9" re:"\\d+\\.?\\d*"` ThresholdIDs string `index:"10" re:""` CreatedAt time.Time } @@ -226,7 +226,7 @@ type TpStat struct { MetricFilterIDs string `index:"8" re:""` Stored bool `index:"9" re:""` Blocker bool `index:"10" re:""` - Weight float64 `index:"11" re:"\d+\.?\d*"` + Weight float64 `index:"11" re:"\\d+\\.?\\d*"` ThresholdIDs string `index:"12" re:""` CreatedAt time.Time } @@ -242,7 +242,7 @@ type TpThreshold struct { MinHits int `index:"5" re:""` MinSleep string `index:"6" re:""` Blocker bool `index:"7" re:""` - Weight float64 `index:"8" re:"\d+\.?\d*"` + Weight float64 `index:"8" re:"\\d+\\.?\\d*"` ActionIDs string `index:"9" re:""` Async bool `index:"10" re:""` CreatedAt time.Time @@ -253,7 +253,7 @@ type TpFilter struct { Tpid string Tenant string `index:"0" re:""` ID string `index:"1" re:""` - Type string `index:"2" re:"^\*[A-Za-z].*"` + Type string `index:"2" re:"^\\*[A-Za-z].*"` Element string `index:"3" re:""` Values string `index:"4" re:""` ActivationInterval string `index:"5" re:""` @@ -363,10 +363,10 @@ type TpSupplier struct { SupplierRatingplanIDs string `index:"9" re:""` SupplierResourceIDs string `index:"10" re:""` SupplierStatIDs string `index:"11" re:""` - SupplierWeight float64 `index:"12" re:"\d+\.?\d*"` + SupplierWeight float64 `index:"12" re:"\\d+\\.?\\d*"` SupplierBlocker bool `index:"13" re:""` SupplierParameters string `index:"14" re:""` - Weight float64 `index:"15" re:"\d+\.?\d*"` + Weight float64 `index:"15" re:"\\d+\\.?\\d*"` CreatedAt time.Time } @@ -383,7 +383,7 @@ type TPAttribute struct { Type string `index:"7" re:""` Value string `index:"8" re:""` Blocker bool `index:"9" re:""` - Weight float64 `index:"10" re:"\d+\.?\d*"` + Weight float64 `index:"10" re:"\\d+\\.?\\d*"` CreatedAt time.Time } @@ -396,7 +396,7 @@ type TPCharger struct { ActivationInterval string `index:"3" re:""` RunID string `index:"4" re:""` AttributeIDs string `index:"5" re:""` - Weight float64 `index:"6" re:"\d+\.?\d*"` + Weight float64 `index:"6" re:"\\d+\\.?\\d*"` CreatedAt time.Time } @@ -412,10 +412,10 @@ type TPDispatcherProfile struct { StrategyParameters string `index:"6" re:""` ConnID string `index:"7" re:""` ConnFilterIDs string `index:"8" re:""` - ConnWeight float64 `index:"9" re:"\d+\.?\d*"` + ConnWeight float64 `index:"9" re:"\\d+\\.?\\d*"` ConnBlocker bool `index:"10" re:""` ConnParameters string `index:"11" re:""` - Weight float64 `index:"12" re:"\d+\.?\d*"` + Weight float64 `index:"12" re:"\\d+\\.?\\d*"` CreatedAt time.Time }