Пример #1
0
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
}
Пример #2
0
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
}
Пример #3
0
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
}
Пример #4
0
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
}
Пример #5
0
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
}
Пример #6
0
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
}