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

filter: values are now always bytes

parent bce485ce
package query package query
import ( import (
"bytes"
"fmt" "fmt"
"reflect"
"strings" "strings"
) )
...@@ -33,21 +33,16 @@ var ( ...@@ -33,21 +33,16 @@ var (
// //
// [*] other than == and !=, which use reflect.DeepEqual. // [*] other than == and !=, which use reflect.DeepEqual.
type FilterValueCompare struct { type FilterValueCompare struct {
Op Op Op Op
Value interface{} Value []byte
TypedFilter Filter
} }
func (f FilterValueCompare) Filter(e Entry) bool { func (f FilterValueCompare) Filter(e Entry) bool {
if f.TypedFilter != nil {
return f.TypedFilter.Filter(e)
}
switch f.Op { switch f.Op {
case Equal: case Equal:
return reflect.DeepEqual(f.Value, e.Value) return bytes.Equal(f.Value, e.Value)
case NotEqual: case NotEqual:
return !reflect.DeepEqual(f.Value, e.Value) return !bytes.Equal(f.Value, e.Value)
default: default:
panic(fmt.Errorf("cannot apply op '%s' to interface{}.", f.Op)) 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