Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Bryan Kaperick
jio
Commits
30b0e964
Commit
30b0e964
authored
Jun 05, 2018
by
Bryan Kaperick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revision history tests are passing as expected now.
parent
adb69072
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
131 additions
and
100 deletions
+131
-100
src/jio.storage/bryanstorage.js
src/jio.storage/bryanstorage.js
+10
-24
test/jio.storage/bryanstorage.tests.js
test/jio.storage/bryanstorage.tests.js
+121
-76
No files found.
src/jio.storage/bryanstorage.js
View file @
30b0e964
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
// Prepare to post the current doc as a deprecated version
// Prepare to post the current doc as a deprecated version
previous_data
=
latest_data
;
previous_data
=
latest_data
;
previous_data
.
_deprecated
=
true
;
previous_data
.
_deprecated
=
"
true
"
;
previous_data
.
_doc_id
=
id
;
previous_data
.
_doc_id
=
id
;
// Get most recent deprecated version's _revision attribute
// Get most recent deprecated version's _revision attribute
...
@@ -53,9 +53,9 @@
...
@@ -53,9 +53,9 @@
})
})
.
push
(
function
(
query_results
)
{
.
push
(
function
(
query_results
)
{
if
(
query_results
.
length
>
0
)
{
if
(
query_results
.
data
.
rows
.
length
>
0
)
{
var
doc_id
=
query_results
[
0
]
;
var
doc_id
=
query_results
.
data
.
rows
[
0
].
id
;
return
this
.
_sub_
storage
.
get
(
doc_id
);
return
sub
storage
.
get
(
doc_id
);
}
}
throw
new
jIO
.
util
.
jIOError
(
throw
new
jIO
.
util
.
jIOError
(
"
bryanstorage: query returned no results.'
"
,
"
bryanstorage: query returned no results.'
"
,
...
@@ -143,30 +143,16 @@
...
@@ -143,30 +143,16 @@
BryanStorage
.
prototype
.
hasCapacity
=
function
()
{
BryanStorage
.
prototype
.
hasCapacity
=
function
()
{
return
this
.
_sub_storage
.
hasCapacity
.
apply
(
this
.
_sub_storage
,
arguments
);
return
this
.
_sub_storage
.
hasCapacity
.
apply
(
this
.
_sub_storage
,
arguments
);
};
};
/**
BryanStorage.prototype.allDocs = function (options) {
BryanStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
if (options === undefined) {
options = {};
}
console.log("options", options);
if
(
options
===
undefined
)
{
if
(
options
===
undefined
)
{
options
=
{
query
:
""
};
options
=
{
query
:
""
};
}
}
options.query = '(' + options.query + ') AND NOT (_deprecated = true)';
if
(
options
.
query
!==
""
)
{
console.log("query string: ", options.query);
options
.
query
=
"
(
"
+
options
.
query
+
"
) AND
"
;
return this._sub_storage.allDocs.apply(this._sub_storage, options);
//return this._sub_storage.buildQuery.apply(this._sub_storage, options);
};
**/
BryanStorage
.
prototype
.
buildQuery
=
function
()
{
/**
if (options === undefined) {
options = {};
}
}
options.query = '(' + options.query + ') AND NOT (_deprecated = true)';
options
.
query
=
options
.
query
+
'
NOT (_deprecated: "true")
'
;
**/
return
this
.
_sub_storage
.
buildQuery
(
options
);
console
.
log
(
"
options
"
,
arguments
);
return
this
.
_sub_storage
.
buildQuery
.
apply
(
this
.
_sub_storage
,
arguments
);
};
};
jIO
.
addStorage
(
'
bryan
'
,
BryanStorage
);
jIO
.
addStorage
(
'
bryan
'
,
BryanStorage
);
...
...
test/jio.storage/bryanstorage.tests.js
View file @
30b0e964
This diff is collapsed.
Click to expand it.
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