func (c *Criterion) In(values ...interface{}) *Query {
	c.operator = in
	c.values = values
	q := c.query
	q.fieldCriteria[q.currentField] = append(q.fieldCriteria[q.currentField], c)
	return q
}
In test if the current field is a member of the slice of values passed in
package badgerhold
import (
	"fmt"
	"reflect"
	"regexp"
	"sort"
	"strings"
	"unicode"
	"github.com/dgraph-io/badger/v3"
)
const (
	eq    = iota  
	ne            
	gt            
	lt            
	ge            
	le            
	in            
	re            
	fn            
	isnil         
	sw            
	ew            
	hk            
	contains  
	any       
	all       
)
const Key = ""
type Query struct {
	index         string
	currentField  string
	fieldCriteria map[string][]*Criterion
	ors           []*Query
	badIndex bool
	dataType reflect.Type
	tx       *badger.Txn
	writable bool
	subquery bool
	bookmark *iterBookmark
	limit   int
	skip    int
	sort    []string
	reverse bool
}
func Slice(value interface{}) []interface{} {
	slc := reflect.ValueOf(value)
	s := make([]interface{}, slc.Len(), slc.Len())  
	for i := range s {
		s[i] = slc.Index(i).Interface()
	}
	return s
}
func (q *Query) IsEmpty() bool {
	if q.index != "" {
		return false
	}
	if len(q.fieldCriteria) != 0 {
		return false
	}
	if q.ors != nil {
		return false
	}
	return true
}
type Criterion struct {
	query    *Query
	operator int
	value    interface{}
	values   []interface{}
}
func hasMatchFunc(criteria []*Criterion) bool {
	for _, c := range criteria {
		if c.operator == fn {
			return true
		}
	}
	return false
}
type Field string
func Where(field string) *Criterion {
	if !startsUpper(field) {
		panic("The first letter of a field in a badgerhold query must be upper-case")
	}
	return &Criterion{
		query: &Query{
			currentField:  field,
			fieldCriteria: make(map[string][]*Criterion),
		},
	}
}
func (q *Query) And(field string) *Criterion {
	if !startsUpper(field) {
		panic("The first letter of a field in a badgerhold query must be upper-case")
	}
	q.currentField = field
	return &Criterion{
		query: q,
	}
}
func (q *Query) Skip(amount int) *Query {
	if amount < 0 {
		panic("Skip must be set to a positive number")
	}
	if q.skip != 0 {
		panic(fmt.Sprintf("Skip has already been set to %d", q.skip))
	}
	q.skip = amount
	return q
}
func (q *Query) Limit(amount int) *Query {
	if amount < 0 {
		panic("Limit must be set to a positive number")
	}
	if q.limit != 0 {
		panic(fmt.Sprintf("Limit has already been set to %d", q.limit))
	}
	q.limit = amount
	return q
}
func (c *Criterion) Contains(value interface{}) *Query {
	return c.op(contains, value)
}
func (c *Criterion) ContainsAll(values ...interface{}) *Query {
	c.operator = all
	c.values = values
	q := c.query
	q.fieldCriteria[q.currentField] = append(q.fieldCriteria[q.currentField], c)
	return q
}
func (c *Criterion) ContainsAny(values ...interface{}) *Query {
	c.operator = any
	c.values = values
	q := c.query
	q.fieldCriteria[q.currentField] = append(q.fieldCriteria[q.currentField], c)
	return q
}
func (c *Criterion) HasKey(value interface{}) *Query {
	return c.op(hk, value)
}
func (q *Query) SortBy(fields ...string) *Query {
	for i := range fields {
		if fields[i] == Key {
			panic("Cannot sort by Key.")
		}
		var found bool
		for k := range q.sort {
			if q.sort[k] == fields[i] {
				found = true
				break
			}
		}
		if !found {
			q.sort = append(q.sort, fields[i])
		}
	}
	return q
}
func (q *Query) Reverse() *Query {
	q.reverse = !q.reverse
	return q
}
func (q *Query) Index(indexName string) *Query {
	if strings.Contains(indexName, ".") {
		panic("Nested indexes are not supported.  Only top level structures can be indexed")
	}
	q.index = indexName
	return q
}
func (q *Query) validateIndex() error {
	if q.index == "" {
		return nil
	}
	if q.dataType == nil {
		panic("Can't check for a valid index before query datatype is set")
	}
	if _, ok := q.dataType.FieldByName(q.index); ok {
		return nil
	}
	for i := 0; i < q.dataType.NumField(); i++ {
		if tag := q.dataType.Field(i).Tag.Get(BadgerHoldIndexTag); tag == q.index {
			q.index = q.dataType.Field(i).Name
			return nil
		}
	}
	return fmt.Errorf("The index %s does not exist", q.index)
}
func (q *Query) Or(query *Query) *Query {
	if query.skip != 0 || query.limit != 0 {
		panic("Or'd queries cannot contain skip or limit values")
	}
	q.ors = append(q.ors, query)
	return q
}
func (q *Query) matchesAllFields(s *Store, key []byte, value reflect.Value, currentRow interface{}) (bool, error) {
	if q.IsEmpty() {
		return true, nil
	}
	for field, criteria := range q.fieldCriteria {
		if field == q.index && !q.badIndex && !hasMatchFunc(criteria) {
			continue
		}
		if field == Key {
			ok, err := s.matchesAllCriteria(criteria, key, true, q.dataType.Name(), currentRow)
			if err != nil {
				return false, err
			}
			if !ok {
				return false, nil
			}
			continue
		}
		fVal, err := fieldValue(value, field)
		if err != nil {
			return false, err
		}
		ok, err := s.matchesAllCriteria(criteria, fVal.Interface(), false, "", currentRow)
		if err != nil {
			return false, err
		}
		if !ok {
			return false, nil
		}
	}
	return true, nil
}
func fieldValue(value reflect.Value, field string) (reflect.Value, error) {
	fields := strings.Split(field, ".")
	current := value
	for i := range fields {
		if current.Kind() == reflect.Ptr {
			current = current.Elem().FieldByName(fields[i])
		} else {
			current = current.FieldByName(fields[i])
		}
		if !current.IsValid() {
			return reflect.Value{}, fmt.Errorf("The field %s does not exist in the type %s", field, value)
		}
	}
	return current, nil
}
func (c *Criterion) op(op int, value interface{}) *Query {
	c.operator = op
	c.value = value
	q := c.query
	q.fieldCriteria[q.currentField] = append(q.fieldCriteria[q.currentField], c)
	return q
}
func (c *Criterion) Eq(value interface{}) *Query {
	return c.op(eq, value)
}
func (c *Criterion) Ne(value interface{}) *Query {
	return c.op(ne, value)
}
func (c *Criterion) Gt(value interface{}) *Query {
	return c.op(gt, value)
}
func (c *Criterion) Lt(value interface{}) *Query {
	return c.op(lt, value)
}
func (c *Criterion) Ge(value interface{}) *Query {
	return c.op(ge, value)
}
func (c *Criterion) Le(value interface{}) *Query {
	return c.op(le, value)
}