Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tristan Cavelier
jio
Commits
4c22ec5b
Commit
4c22ec5b
authored
Apr 04, 2018
by
Vincent Bechu
Committed by
Vincent Bechu
Apr 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Queries: Fix sort_on in complex query with key_schema
/reviewed-on
!81
parent
59397711
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
src/queries/query.js
src/queries/query.js
+1
-1
test/queries/key-schema.tests.js
test/queries/key-schema.tests.js
+58
-0
No files found.
src/queries/query.js
View file @
4c22ec5b
...
...
@@ -507,7 +507,7 @@
* @param {String} spec.value The value of the metadata to compare
*/
function
ComplexQuery
(
spec
,
key_schema
)
{
Query
.
call
(
this
);
Query
.
call
(
this
,
key_schema
);
/**
* Logical operator to use to compare object values
...
...
test/queries/key-schema.tests.js
View file @
4c22ec5b
...
...
@@ -232,6 +232,64 @@
RSVP
.
all
(
promise
).
then
(
noop
).
always
(
start
);
});
test
(
'
Test key schema + jio query with sort on
'
,
function
()
{
var
docList
=
function
()
{
return
[
{
'
identifier
'
:
'
10
'
,
'
number
'
:
'
10
'
},
{
'
identifier
'
:
'
2
'
,
'
number
'
:
'
2
'
},
{
'
identifier
'
:
'
19
'
,
'
number
'
:
'
19
'
},
{
'
identifier
'
:
'
100
'
,
'
number
'
:
'
100
'
}
];
},
test_key_schema
=
{
cast_lookup
:
{
intType
:
function
(
value
)
{
if
(
typeof
value
===
'
string
'
)
{
return
parseInt
(
value
,
10
);
}
return
value
;
}
},
key_set
:
{
number
:
{
read_from
:
'
number
'
,
cast_to
:
'
intType
'
}
}
},
promise
=
[];
stop
();
promise
.
push
(
jIO
.
QueryFactory
.
create
({
type
:
'
complex
'
,
operator
:
'
OR
'
,
query_list
:
[{
type
:
'
simple
'
,
key
:
'
number
'
,
operator
:
'
<
'
,
value
:
'
19
'
},
{
type
:
'
simple
'
,
key
:
'
number
'
,
operator
:
'
=
'
,
value
:
'
19
'
}]
},
test_key_schema
).
exec
(
docList
(),
{
sort_on
:
[[
'
number
'
,
'
ascending
'
]]}
).
then
(
function
(
dl
)
{
deepEqual
(
dl
,
[
{
'
identifier
'
:
'
2
'
,
'
number
'
:
'
2
'
},
{
'
identifier
'
:
'
10
'
,
'
number
'
:
'
10
'
},
{
'
identifier
'
:
'
19
'
,
'
number
'
:
'
19
'
}
],
'
Key schema should be propagated from complex to simple queries
'
);
})
);
RSVP
.
all
(
promise
).
then
(
noop
).
always
(
start
);
});
test
(
'
Key Schema with translation lookup
'
,
function
()
{
var
docList
=
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment