SmallestPositiveIntPerTenant is returning the minimal positive value of the supplied limit function for all given tenants.
(tenantIDs []string, f func(string) int)
| 1176 | // SmallestPositiveIntPerTenant is returning the minimal positive value of the |
| 1177 | // supplied limit function for all given tenants. |
| 1178 | func SmallestPositiveIntPerTenant(tenantIDs []string, f func(string) int) int { |
| 1179 | var result *int |
| 1180 | for _, tenantID := range tenantIDs { |
| 1181 | v := f(tenantID) |
| 1182 | if result == nil || v < *result { |
| 1183 | result = &v |
| 1184 | } |
| 1185 | } |
| 1186 | if result == nil { |
| 1187 | return 0 |
| 1188 | } |
| 1189 | return *result |
| 1190 | } |
| 1191 | |
| 1192 | // SmallestPositiveNonZeroFloat64PerTenant is returning the minimal positive and |
| 1193 | // non-zero value of the supplied limit function for all given tenants. In many |
no outgoing calls