Commit 623a7ba3 authored by Steven Allen's avatar Steven Allen

filter: values are now always bytes

parent bce485ce
package query
import (
"bytes"
"fmt"
"reflect"
"strings"
)
......@@ -34,20 +34,15 @@ var (
// [*] other than == and !=, which use reflect.DeepEqual.
type FilterValueCompare struct {
Op Op
Value interface{}
TypedFilter Filter
Value []byte
}
func (f FilterValueCompare) Filter(e Entry) bool {
if f.TypedFilter != nil {
return f.TypedFilter.Filter(e)
}
switch f.Op {
case Equal:
return reflect.DeepEqual(f.Value, e.Value)
return bytes.Equal(f.Value, e.Value)
case NotEqual:
return !reflect.DeepEqual(f.Value, e.Value)
return !bytes.Equal(f.Value, e.Value)
default:
panic(fmt.Errorf("cannot apply op '%s' to interface{}.", f.Op))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment