Constructor
new BaseFilter(urlPlaceholderopt)
A class for creating SlashDB-compatible URL strings
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
urlPlaceholder |
string |
<optional> |
__ | a string that contains a character or string to set for the placeholder query parameter (used to indicate what char/string |
- Source:
Methods
_columnArrayParser(…columns) → {undefined|string}
Parses out column names; used by sort()
and cols()
methods. Not called directly.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
columns |
string |
<repeatable> |
a comma delimited list of column names to parse (e.g. |
- Source:
Throws:
-
-
if no columns given, or if any column names are not strings, or are empty strings
- Type
- TypeError
-
-
-
if any column names contain spaces, or parse to numbers
- Type
- SyntaxError
-
Returns:
-
if one column given and value of column is false (resets
sort()
/cols()
)- Type
- undefined
-
string of column names separated by ','
- Type
- string
_sort_asc(col) → {string}
Mark a column as ascending for sort()
method. Not used in class; exposed externally as its own function in this module; note
that this method doesn't do any modifications to the column name, it's here just so developers have an explicit method
Parameters:
Name | Type | Description |
---|---|---|
col |
string | a column name to mark as descending |
- Source:
Throws:
-
-
if column name given is not a string
- Type
- TypeError
-
-
-
if column name given contains spaces or parses to a number
- Type
- SyntaxError
-
Returns:
a column name that has been marked as ascending for sort()
method (effectively, no changes to input)
- Type
- string
_sort_desc(col) → {string}
Mark a column as descending for sort()
method. Not used in class; exposed externally as its own function in this module
Parameters:
Name | Type | Description |
---|---|---|
col |
string | a column name to mark as descending |
- Source:
Throws:
-
-
if column name given is not a string
- Type
- TypeError
-
-
-
if column name given contains spaces or parses to a number
- Type
- SyntaxError
-
Returns:
a column name that has been marked as descending for sort()
method
- Type
- string
_urlPlaceholderFn() → {string}
Sets the placeholder
query string parameter; only used internally
- Source:
Returns:
an empty string, or a query parameter string for the placeholder query parameter
- Type
- string
build() → {Object}
Builds the URL endpoint string from the filter strings provided to the class and the query string parameters that have been set;
called at the end of most filter string methods and query string parameter methods
- Source:
Returns:
the current instance of this class
- Type
- Object
cols(…columns)
Appends the URL with set of columns to return from request
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
columns |
string |
<repeatable> |
a list of column names (e.g. |
- Source:
Returns:
this object
distinct(toggleopt)
Sets the distinct
query string parameter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
toggle |
boolean |
<optional> |
true | sets the parameter if not provided; removes the parameter if set to false |
- Source:
Returns:
this object
limit(numRowsopt)
Sets the limit
query string parameter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
numRows |
number | boolean |
<optional> |
false | sets the parameter with the value provided; removes the |
- Source:
Throws:
-
if value provided is not an integer or < 1
- Type
- TypeError
Returns:
this object
nullStr(nullStringopt)
Sets the nullStr
query string parameter
When using the composable filter functions, if the chgPlaceHolder
function is invoked to change the default
null
placeholder, any BaseFilter
, DataDiscoveryFilter
, and SQLPassThruFilter
objects created after changing
the placeholder will have the nullStr
query string parameter automatically set to the value passed to chgPlaceHolder
.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nullString |
string |
<optional> |
sets parameter with the value provided, resets to default if not given |
- Source:
Throws:
-
if value provided is not a valid string
- Type
- TypeError
Returns:
this object
offset(numRowsopt)
Sets the offset
query string parameter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
numRows |
number | boolean |
<optional> |
false | sets the parameter with the value provided; removes the |
- Source:
Throws:
-
if value provided is not an integer or < 1
- Type
- TypeError
Returns:
this object
sort(…columns)
Set the sort query string parameter
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
columns |
string |
<repeatable> |
a list of column names to sort by (e.g. |
- Source:
Returns:
this object
str() → {string}
Returns the URL endpoint string in this class created by build()
- Source:
Returns:
the URL endpoint string
- Type
- string
transpose(toggleopt)
Sets the transpose
query string parameter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
toggle |
boolean |
<optional> |
true | sets parameter if not provided; removes the parameter if set to false |
- Source:
Returns:
this object
xmlNilVisible(toggleopt)
Sets the nil_visible
query string parameter
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
toggle |
boolean |
<optional> |
true | sets the parameter if not provided; removes the parameter if set to false |
- Source:
Returns:
this object