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
Mukul
jio
Commits
26c8da78
Commit
26c8da78
authored
Jun 11, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make queries doc string fully compatible with yuidoc
parent
a4f3d0d1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
27 deletions
+42
-27
src/queries/begin.js
src/queries/begin.js
+1
-1
src/queries/complexquery.js
src/queries/complexquery.js
+5
-2
src/queries/parser-begin.js
src/queries/parser-begin.js
+0
-6
src/queries/query.js
src/queries/query.js
+12
-7
src/queries/queryfactory.js
src/queries/queryfactory.js
+17
-3
src/queries/simplequery.js
src/queries/simplequery.js
+5
-3
src/queries/tool.js
src/queries/tool.js
+2
-5
No files found.
src/queries/begin.js
View file @
26c8da78
...
...
@@ -15,7 +15,7 @@ var complex_queries;
var
to_export
=
{},
module_name
=
"
complex_queries
"
;
/**
* Add a secured (write permission denied) property to an object.
*
@method defineProperty
*
* @param {Object} object The object to fill
* @param {String} key The object key where to store the property
* @param {Any} value The value to store
...
...
src/queries/complexquery.js
View file @
26c8da78
...
...
@@ -7,6 +7,7 @@
* values.
*
* @class ComplexQuery
* @extends Query
* @param {Object} [spec={}] The specifications
* @param {String} [spec.operator="AND"] The compare method to use
* @param {String} spec.key The metadata key
...
...
@@ -18,18 +19,20 @@ var ComplexQuery = newClass(Query, function (spec) {
/**
* Logical operator to use to compare object values
*
* @
property
operator
* @
attribute
operator
* @type String
* @default "AND"
* @optional
*/
this
.
operator
=
spec
.
operator
||
"
AND
"
;
/**
* The sub Query list which are used to query an item.
*
* @
property
query_list
* @
attribute
query_list
* @type Array
* @default []
* @optional
*/
this
.
query_list
=
spec
.
query_list
||
[];
this
.
query_list
=
this
.
query_list
.
map
(
QueryFactory
.
create
);
...
...
src/queries/parser-begin.js
View file @
26c8da78
/**
* Parse a text request to a json query tree
* @method parseStringToObject
* @param {String} string The string to parse
* @return {Object} The json query tree
*/
function
parseStringToObject
(
string
)
{
src/queries/query.js
View file @
26c8da78
...
...
@@ -14,8 +14,10 @@ var Query = newClass(function (spec) {
/**
* The wildcard character used to extend comparison action
*
* @
property
wildcard_character
* @
attribute
wildcard_character
* @type String
* @default "%"
* @optional
*/
this
.
wildcard_character
=
spec
.
wildcard_character
||
"
%
"
;
...
...
@@ -24,13 +26,13 @@ var Query = newClass(function (spec) {
*
* @method exec
* @param {Array} item_list The list of object
* @param {Object} [option
={}
] Some operation option
* @param {Object} [option] Some operation option
* @param {String} [option.wildcard_character="%"] The wildcard character
* @param {Array} [option.select_list
=undefined
] A object keys to retrieve
* @param {Array} [option.sort_on
=[]] Couples of object keys
*
and "ascending"
or "descending"
* @param {Array} [option.limit
=undefined] Couple of integer, first is an
*
index and
second is the length.
* @param {Array} [option.select_list] A object keys to retrieve
* @param {Array} [option.sort_on
] Couples of object keys and "ascending"
* or "descending"
* @param {Array} [option.limit
] Couple of integer, first is an index and
* second is the length.
*/
this
.
exec
=
function
(
item_list
,
option
)
{
var
i
=
0
;
...
...
@@ -92,6 +94,7 @@ var Query = newClass(function (spec) {
* Filter a list of items, modifying them to select only wanted keys.
*
* @method filterListSelect
* @static
* @param {Array} select_option Key list to keep
* @param {Array} list The item list to filter
*/
...
...
@@ -115,6 +118,7 @@ var Query = newClass(function (spec) {
* Sort a list of items, according to keys and directions.
*
* @method sortOn
* @static
* @param {Array} sort_on_option List of couples [key, direction]
* @param {Array} list The item list to sort
*/
...
...
@@ -133,6 +137,7 @@ var Query = newClass(function (spec) {
* Parse a text request to a json query object tree
*
* @method parseStringToObject
* @static
* @param {String} string The string to parse
* @return {Object} The json query tree
*/
...
...
src/queries/queryfactory.js
View file @
26c8da78
...
...
@@ -2,13 +2,27 @@
/*global _export: true, ComplexQuery: true, SimpleQuery: true,
newClass: true, Query: true */
// XXX
var
query_class_dict
=
{},
QueryFactory
;
/**
* Provides static methods to create Query object
*
* @class QueryFactory
*/
QueryFactory
=
newClass
({
"
secure_methods
"
:
true
,
"
static_methods
"
:
{
// XXX
/**
* Creates Query object from a search text string or a serialized version
* of a Query.
*
* @method create
* @static
* @param {Object,String} object The search text or the serialized version
* of a Query
* @return {Query} A Query object
*/
"
create
"
:
function
(
object
)
{
if
(
object
===
""
)
{
return
new
Query
();
...
...
src/queries/simplequery.js
View file @
26c8da78
...
...
@@ -6,6 +6,7 @@
* The SimpleQuery inherits from Query, and compares one metadata value
*
* @class SimpleQuery
* @extends Query
* @param {Object} [spec={}] The specifications
* @param {String} [spec.operator="="] The compare method to use
* @param {String} spec.key The metadata key
...
...
@@ -16,16 +17,17 @@ var SimpleQuery = newClass(Query, function (spec) {
/**
* Operator to use to compare object values
*
* @
property
operator
* @
attribute
operator
* @type String
* @default "="
* @optional
*/
this
.
operator
=
spec
.
operator
||
"
=
"
;
/**
* Key of the object which refers to the value to compare
*
* @
property
key
* @
attribute
key
* @type String
*/
this
.
key
=
spec
.
key
;
...
...
@@ -33,7 +35,7 @@ var SimpleQuery = newClass(Query, function (spec) {
/**
* Value is used to do the comparison with the object value
*
* @
property
value
* @
attribute
value
* @type String
*/
this
.
value
=
spec
.
value
;
...
...
src/queries/tool.js
View file @
26c8da78
...
...
@@ -5,7 +5,6 @@
* Create a class, manage inheritance, static methods,
* protected attributes and can hide methods or/and secure methods
*
* @method newClass
* @param {Class} Class Classes to inherit from (0..n). The last class
* parameter will inherit from the previous one, and so on
* @param {Object} option Class option (0..n)
...
...
@@ -100,7 +99,7 @@ function newClass() {
/**
* Escapes regexp special chars from a string.
*
@method stringEscapeRegexpCharacters
*
* @param {String} string The string to escape
* @return {String} The escaped string
*/
...
...
@@ -109,11 +108,10 @@ function stringEscapeRegexpCharacters(string) {
return
string
.
replace
(
/
([\\\.\$\[\]\(\)\{\}\^\?\*\+\-])
/g
,
"
\\
$1
"
);
}
}
_export
(
"
stringEscapeRegexpCharacters
"
,
stringEscapeRegexpCharacters
);
/**
* Convert a search text to a regexp.
*
@method convertSearchTextToRegExp
*
* @param {String} string The string to convert
* @param {String} [wildcard_character=undefined] The wildcard chararter
* @return {RegExp} The search text regexp
...
...
@@ -124,7 +122,6 @@ function convertSearchTextToRegExp(string, wildcard_character) {
'
.*
'
)
+
"
$
"
);
}
_export
(
"
convertSearchTextToRegExp
"
,
convertSearchTextToRegExp
);
// XXX
function
sortFunction
(
key
,
way
)
{
...
...
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