Skip to content
Snippets Groups Projects
fixIndices.go 502 B
package entity

/*
A function that maps pill IDs to a range of 0..x
*/
func FixIndices(JSONQuery *IncomingQueryJSON) (map[int]int, map[int]int, map[int]int) {
	entityMap := make(map[int]int)
	for i, e := range JSONQuery.Entities {
		entityMap[e.ID] = i
	}
	relationMap := make(map[int]int)
	for i, r := range JSONQuery.Relations {
		relationMap[r.ID] = i
	}
	groupByMap := make(map[int]int)
	for i, g := range JSONQuery.GroupBys {
		groupByMap[g.ID] = i
	}
	return entityMap, relationMap, groupByMap
}