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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
jio
Commits
d7ecff55
Commit
d7ecff55
authored
Jun 04, 2018
by
Bryan Kaperick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Still debugging query issue.
parent
44628a99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
19 deletions
+30
-19
src/jio.storage/bryanstorage.js
src/jio.storage/bryanstorage.js
+5
-3
test/jio.storage/bryanstorage.tests.js
test/jio.storage/bryanstorage.tests.js
+25
-16
No files found.
src/jio.storage/bryanstorage.js
View file @
d7ecff55
...
...
@@ -48,7 +48,9 @@
sort_on
:
[[
'
_revision
'
,
'
descending
'
]],
limit
:
[
0
,
1
]
};
return
substorage
.
buildQuery
(
options
);
//return substorage.buildQuery(options);
return
substorage
.
allDocs
(
options
);
})
.
push
(
function
(
query_results
)
{
if
(
query_results
.
length
>
0
)
{
...
...
@@ -141,21 +143,21 @@
BryanStorage
.
prototype
.
hasCapacity
=
function
()
{
return
this
.
_sub_storage
.
hasCapacity
.
apply
(
this
.
_sub_storage
,
arguments
);
};
/**
BryanStorage.prototype.allDocs = function (options) {
if (options === undefined) {
options = {};
}
console.log("options", options);
/**
if (options === undefined) {
options = {query: ""};
}
options.query = '(' + options.query + ') AND NOT (_deprecated = true)';
console.log("query string: ", options.query);
**/
return this._sub_storage.allDocs.apply(this._sub_storage, options);
//return this._sub_storage.buildQuery.apply(this._sub_storage, options);
};
**/
BryanStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
if
(
options
===
undefined
)
{
options
=
{};
...
...
test/jio.storage/bryanstorage.tests.js
View file @
d7ecff55
...
...
@@ -25,7 +25,12 @@
// create storage of type "bryan" with memory as substorage
var jio = jIO.createJIO({
type: "bryan",
sub_storage: {type: "memory"}
sub_storage: {
type: "uuid",
sub_storage: {
type: "memory"
}
}
});
jio.put("bar", {"title": "foo"});
...
...
@@ -54,12 +59,12 @@
sub_storage
:
{
type
:
"
uuid
"
,
sub_storage
:
{
//
type: "memory"
type
:
"
indexeddb
"
,
database
:
dbname
type
:
"
memory
"
//
type: "indexeddb",
//
database: dbname
}
}
}),
})
;
/**
,
not_bryan = jIO.createJIO({
type: "uuid",
sub_storage: {
...
...
@@ -71,10 +76,12 @@
}
}
});
**/
jio
.
put
(
"
doc1
"
,
{
"
title
"
:
"
rev0
"
,
"
subtitle
"
:
"
subrev0
"
})
/**
.push(function () {return jio.get("doc1"); })
.push(function (result) {
deepEqual(result, {
...
...
@@ -103,14 +110,15 @@
"subtitle": "subrev2"
}, "Retrieve second edition of document correctly");
})
**/
.
push
(
function
()
{
var
options
=
{
//query: ""//title: rev2
"
query
:
"
title: rev0
"
};
//
//
return
jio
.
buildQuery
(
options
);
//
return jio.allDocs(options);
//
return jio.buildQuery(options);
return
jio
.
allDocs
(
options
);
//
//
})
...
...
@@ -127,7 +135,7 @@
"
subtitle
"
:
"
subrev2
"
},
"
Retrieve queried document correctly
"
);
})
/**
// When not_bryan queries the storage, all documents are returned.
.push(function () {
var options = {
...
...
@@ -152,6 +160,7 @@
},
"Get the earliest copy of the doc with all metadata.");
})
**/
.
fail
(
function
(
error
)
{
console
.
log
(
error
);
ok
(
false
,
error
);
...
...
@@ -231,7 +240,7 @@
},
"
Retrieve other document correctly
"
);
})
.
push
(
function
()
{
return
jio
.
buildQuery
({
return
jio
.
allDocs
({
query
:
""
});
})
...
...
@@ -240,7 +249,7 @@
equal
(
result
.
length
,
2
,
"
Empty query returns only non-deprecated docs
"
);
})
.
push
(
function
()
{
return
jio
.
buildQuery
({
return
jio
.
allDocs
({
query
:
'
attr: "version1"
'
});
})
...
...
@@ -257,7 +266,7 @@
},
"
Retrieve other document correctly
"
);
})
.
push
(
function
()
{
return
jio
.
buildQuery
({
return
jio
.
allDocs
({
query
:
'
(_doc_id: "other_doc")
'
});
})
...
...
@@ -265,7 +274,7 @@
equal
(
result
.
length
,
0
,
"
Correct number of results returned
"
);
})
.
push
(
function
()
{
return
jio
.
buildQuery
({
return
jio
.
allDocs
({
query
:
'
(_revision: 0)
'
});
})
...
...
@@ -273,7 +282,7 @@
equal
(
result
.
length
,
0
,
"
Correct number of results returned
"
);
})
.
push
(
function
()
{
return
jio
.
buildQuery
({
return
jio
.
allDocs
({
query
:
''
});
})
...
...
@@ -287,7 +296,7 @@
query
:
"
_doc_id: main_doc
"
,
sort_on
:
[[
"
_revision
"
,
"
ascending
"
]]
};
return
not_bryan
.
buildQuery
(
options
);
return
not_bryan
.
allDocs
(
options
);
})
.
push
(
function
(
results
)
{
equal
(
results
.
length
,
3
,
"
should get all 3 deprecated versions.
"
);
...
...
@@ -310,7 +319,7 @@
query
:
"
_doc_id: main_doc
"
,
sort_on
:
[[
"
_revision
"
,
"
ascending
"
]]
};
return
not_bryan
.
buildQuery
(
options
);
return
not_bryan
.
allDocs
(
options
);
})
.
push
(
function
(
results
)
{
return
not_bryan
.
get
(
results
[
1
].
id
);
...
...
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