mirror of
https://github.com/safing/portbase
synced 2025-09-01 18:19:57 +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.
|
||||
func (q *Query) Matches(r record.Record) bool {
|
||||
if q.MatchesKey(r.DatabaseKey()) {
|
||||
return true
|
||||
if !q.MatchesKey(r.DatabaseKey()) {
|
||||
return false
|
||||
}
|
||||
return q.MatchesRecord(r)
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/Safing/portbase/database/record"
|
||||
"github.com/Safing/portbase/formats/dsd"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -65,7 +66,7 @@ func TestQuery(t *testing.T) {
|
|||
// if !gjson.Valid(testJSON) {
|
||||
// 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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue