1 | /**
|
2 | * Query Parameters Object
|
3 | *
|
4 | * @class FoxHoundQueryParameters
|
5 | * @constructor
|
6 | */
|
7 | var FoxHoundQueryParameters = (
|
8 | {
|
9 | scope: false, // STR: The scope of the data
|
10 | // TSQL: the "Table" or "View"
|
11 | // MongoDB: the "Collection"
|
12 |
|
13 | dataElements: false, // ARR of STR: The data elements to return
|
14 | // TSQL: the "Columns"
|
15 | // MongoDB: the "Fields"
|
16 |
|
17 | begin: false, // INT: Record index to start at
|
18 | // TSQL: n in LIMIT 1,n
|
19 | // MongoDB: n in Skip(n)
|
20 |
|
21 | cap: false, // INT: Maximum number of records to return
|
22 | // TSQL: n in LIMIT n
|
23 | // MongoDB: n in limit(n)
|
24 |
|
25 | // Serialization example for a query:
|
26 | // Take the filter and return an array of filter instructions
|
27 | // Basic instruction anatomy:
|
28 | // INSTRUCTION~FIELD~OPERATOR~VALUE
|
29 | // FOP - Filter Open Paren
|
30 | // FOP~~(~
|
31 | // FCP - Filter Close Paren
|
32 | // FCP~~)~
|
33 | // FBV - Filter By Value
|
34 | // FBV~Category~EQ~Books
|
35 | // Possible comparisons:
|
36 | // * EQ - Equals To (=)
|
37 | // * NE - Not Equals To (!=)
|
38 | // * GT - Greater Than (>)
|
39 | // * GE - Greater Than or Equals To (>=)
|
40 | // * LT - Less Than (<)
|
41 | // * LE - Less Than or Equals To (<=)
|
42 | // * LK - Like (Like)
|
43 | // FBL - Filter By List (value list, separated by commas)
|
44 | // FBL~Category~EQ~Books,Movies
|
45 | // FSF - Filter Sort Field
|
46 | // FSF~Category~ASC~0
|
47 | // FSF~Category~DESC~0
|
48 | // FCC - Filter Constraint Cap (the limit of what is returned)
|
49 | // FCC~~10~
|
50 | // FCB - Filter Constraint Begin (the zero-based start index of what is returned)
|
51 | // FCB~~10~
|
52 | //
|
53 | // This means: FBV~Category~EQ~Books~FBV~PublishedYear~GT~2000~FSF~PublishedYear~DESC~0
|
54 | // Filters down to ALL BOOKS PUBLISHED AFTER 2000 IN DESCENDING ORDER
|
55 | filter: false, // ARR of OBJ: Data filter expression list {Column:'Name', Operator:'EQ', Value:'John', Connector:'And', Parameter:'Name'}
|
56 | // TSQL: the WHERE clause
|
57 | // MongoDB: a find() expression
|
58 |
|
59 | sort: false, // ARR of OBJ: The sort order {Column:'Birthday', Direction:'Ascending'}
|
60 | // TSQL: ORDER BY
|
61 | // MongoDB: sort()
|
62 |
|
63 | join: false, // ARR of OBJ: The join tables {Type:'INNER JOIN', Table:'test', From: 'Test.ID', To: 'Scope.IDItem' }
|
64 | // TSQL: JOIN
|
65 |
|
66 | // Force a specific query to run regardless of above ... this is used to override the query generator.
|
67 | queryOverride: false,
|
68 |
|
69 | // Where the generated query goes
|
70 | query: false,
|
71 | /*
|
72 | {
|
73 | body: false,
|
74 | schema: false, // The schema to intersect with our records
|
75 | IDUser: 0, // The User ID to stamp into records
|
76 | UUID: A_UUID, // Some globally unique record id, different per cloned query.
|
77 | records: false, // The records to be created or changed
|
78 | parameters: {}
|
79 | }
|
80 | */
|
81 |
|
82 | // Who is making the query
|
83 | userID: 0,
|
84 |
|
85 | // Where the query results are stuck
|
86 | result: false
|
87 | /*
|
88 | {
|
89 | executed: false, // True once we've run a query.
|
90 | value: false, // The return value of the last query run
|
91 | error: false // The error message of the last run query
|
92 | }
|
93 | */
|
94 | });
|
95 |
|
96 | module.exports = FoxHoundQueryParameters; |
\ | No newline at end of file |