mirror of
https://github.com/safing/portbase
synced 2025-09-04 11:40:23 +00:00
Fix database/query issue
This commit is contained in:
parent
4bfff91279
commit
15ea65a61d
2 changed files with 4 additions and 3 deletions
|
@ -125,8 +125,8 @@ func (q *Query) MatchesAccessor(acc accessor.Accessor) bool {
|
||||||
|
|
||||||
// Matches checks whether the query matches the supplied database record.
|
// Matches checks whether the query matches the supplied database record.
|
||||||
func (q *Query) Matches(r record.Record) bool {
|
func (q *Query) Matches(r record.Record) bool {
|
||||||
if q.MatchesKey(r.DatabaseKey()) {
|
if !q.MatchesKey(r.DatabaseKey()) {
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
return q.MatchesRecord(r)
|
return q.MatchesRecord(r)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/Safing/portbase/database/record"
|
"github.com/Safing/portbase/database/record"
|
||||||
|
"github.com/Safing/portbase/formats/dsd"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -65,7 +66,7 @@ func TestQuery(t *testing.T) {
|
||||||
// if !gjson.Valid(testJSON) {
|
// if !gjson.Valid(testJSON) {
|
||||||
// t.Fatal("test json is invalid")
|
// t.Fatal("test json is invalid")
|
||||||
// }
|
// }
|
||||||
r, err := record.NewWrapper("", nil, append([]byte("J"), []byte(testJSON)...))
|
r, err := record.NewWrapper("", nil, dsd.JSON, []byte(testJSON))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue