func GetCountryMap() (map[int]Country, error) { countryMap := make(map[int]Country) countries, err := GetAllCountries() for _, country := range countries { countryMap[country.Id] = country redis_key := "country:" + strconv.Itoa(country.Id) err = redis.Set(redis_key, country) } return countryMap, err }
func GetStateMap() (map[int]State, error) { stateMap := make(map[int]State) states, err := GetAllStates() for _, state := range states { stateMap[state.Id] = state redis_key := "state:" + strconv.Itoa(state.Id) err = redis.Set(redis_key, state) } return stateMap, err }
func SalesRepMap() (map[int]SalesRepresentative, error) { repMap := make(map[int]SalesRepresentative) reps, err := GetSalesReps() if err != nil { return repMap, err } for _, rep := range reps { repMap[rep.ID] = rep //set redis redis_key := "salesRep:" + strconv.Itoa(rep.ID) err = redis.Set(redis_key, rep) } return repMap, err }
func MapixMap() (map[int]MapixCode, error) { mapixMap := make(map[int]MapixCode) mcs, err := GetMapixCodes() if err != nil { return mapixMap, err } for _, mc := range mcs { mapixMap[mc.ID] = mc //set redis redis_key := "mapixCode:" + strconv.Itoa(mc.ID) err = redis.Set(redis_key, mc) } return mapixMap, err }
func DealerTierMap(dtx *apicontext.DataContext) (map[int]DealerTier, error) { tierMap := make(map[int]DealerTier) var err error dTiers, err := GetDealerTiers(dtx) if err != nil { return tierMap, err } for _, dTier := range dTiers { tierMap[dTier.Id] = dTier //set redis redis_key := "dealerTier:" + strconv.Itoa(dTier.Id) err = redis.Set(redis_key, dTier) } return tierMap, err }
func DealerTypeMap(dtx *apicontext.DataContext) (map[int]DealerType, error) { typeMap := make(map[int]DealerType) var err error dTypes, err := GetDealerTypes(dtx) if err != nil { return typeMap, err } for _, dType := range dTypes { typeMap[dType.Id] = dType //set redis redis_key := "dealerType:" + strconv.Itoa(dType.Id) err = redis.Set(redis_key, dType) } return typeMap, err }