Exemplo n.º 1
0
func evalOrClause(orVal []interface{}) []uint64 {
	aTemp := make([][]uint64, 0)

	for idx := range orVal {
		aTemp = append(aTemp, evalWhereClause(orVal[idx].(map[string]interface{})))
	}

	// find union
	unsortedKeys := arrayOperations.UnionUint64Arr(aTemp)

	// the above may be unsorted, so we need to sort it!
	if !sort.IsSorted(uintArray(unsortedKeys)) {
		// the array is not sorted, sort it!
		sort.Sort(uintArray(unsortedKeys))
	}

	return unsortedKeys
}
Exemplo n.º 2
0
func evalInClause(colName string, inVal []interface{}) []uint64 {
	// build the array that will hold the idx's
	aTemp := make([][]uint64, 0)

	// loop through the acceptable values, adding the matching idx's to our array
	for idx := range inVal {
		// NOTE(@adam-hanna): we only support strings for now!
		aTemp = append(aTemp, index.QueryIndex(colName, inVal[idx].(string)))
	}

	// find union bc our keys are allowed to be any of these
	unsortedKeys := arrayOperations.UnionUint64Arr(aTemp)

	// the above may be unsorted, so we need to sort it!
	if !sort.IsSorted(uintArray(unsortedKeys)) {
		// the array is not sorted, sort it!
		sort.Sort(uintArray(unsortedKeys))
	}

	return unsortedKeys
}