Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

modio::FilterCreator

Ahmed Castro edited this page Oct 16, 2018 · 3 revisions

The modio::FilterCreator is passed to Mods functions to filter the results.

Filtering API documentation: Filtering

setSort

void FilterCreator::setSort(const std::string& field, bool ascending);

API filtering parameter: _sort (Sort)

Sort by a column, on ascending or descending order.

Name Type Description
field const std::string& Column where the sorting is applied.
ascending bool If set to true the result will be sorted on ascending order, otherwise on descending order.

setLimit

void FilterCreator::setLimit(u32 limit)

API filtering parameter: _limit (Limit)

Limit the number of results for a request.

Name Type Description
limit u32 Number of results.

setOffset

void FilterCreator::setOffset(`u32` offset)

API filtering parameter: _offset

Excludes a given amount of registers ordered by id. Use this to paginate your results combined with setLimit.

Name Type Description
offset u32 Amount to registers to be excluded from the result ordered by id.

setFullTextSearch

void FilterCreator::setFullTextSearch(`const std::string&` text)

API filtering parameter: _q (Full text search)

Full-text search is a lenient search filter that is only available if the object you are querying contains a name column.

Name Type Description
text const std::string& Searched text.

setCacheMaxAgeSeconds

void FilterCreator::setCacheMaxAgeSeconds(u32 max_age_seconds)

API filtering parameter: N/A

Maximum time in seconds that a fetched response will be allowed to be reused from the local cache.

Name Type Description
max_age_seconds u32 Maximum cache age allowed.

addFieldValue

void FilterCreator::addFieldValue(const std::string& field, const std::string& value)

Filters to the exact field's value match.

Name Type Description
field const std::string& Filtered column.
value const std::string& String filter value. Supports the * wildcard.

addLikeField

void FilterCreator::addLikeField(const std::string& field, const std::string& value)

API filtering parameter: _lk (Like)

Where the string supplied matches the preceding column value. This is the equivalent to SQL's LIKE. The * wildcard is supported e.g. addLikeField(filter, "name", "The world of *").

Name Type Description
field const std::string& Filtered column.
value const std::string& String filter value. Supports the * wildcard.

addNotLikeField

void FilterCreator::addNotLikeField(const std::string& field, const std::string& value)

API filtering parameter: -not-lk (Not like)

Where the string supplied does not match the preceding column value. This is the equivalent to SQL's NOT LIKE. The * wildcard is supported e.g. addNotLikeField(filter, "name", "The world of *").

Name Type Description
field const std::string& Filtered column.
value const std::string& String filter value. Supports the * wildcard.

addInField

void FilterCreator::addInField(`const std::string&` field, `const std::string&` value)

API filtering parameter: -in (In)

Where the supplied list of values appears in the preceding column value. This is the equivalent to SQL's IN.

Name Type Description
field const std::string& Filtered column.
value const std::string& Filter value.

addNotInField

void FilterCreator::addNotInField(const std::string& field, const std::string& value)

API filtering parameter: -not-in (Not In)

Where the supplied list of values does not in the preceding column value. This is the equivalent to SQL's NOT IN

Name Type Description
field const std::string& Filtered column.
value const std::string& Filter value.

addMinField

void FilterCreator::addMinField(const std::string& field, double value)

API filtering parameter: -min (Min)

Where the preceding column value is greater than or equal to the value specified.

Name Type Description
field const std::string& Filtered column.
value double Filter value.

addMaxField

void FilterCreator::addMaxField(const std::string& field, double value)

API filtering parameter: -max (Max)

Where the preceding column value is smaller than or equal to the value specified.

Name Type Description
field const std::string& Filtered column.
value double Filter value.

addSmallerThanField

void FilterCreator::addSmallerThanField(const std::string& field, double value)

API filtering parameter: -st (Smaller Than)

Where the preceding column value is smaller than the value specified.

Name Type Description
field const std::string& Filtered column.
value double Filter value.

addGreaterThanField

void FilterCreator::addGreaterThanField(const std::string& field, double value)

API filtering parameter: -gt (Greater Than)

Where the preceding column value is greater than the value specified.

Name Type Description
field const std::string& Filtered column.
value double Filter value.

addNotEqualField

void FilterCreator::addNotEqualField(const std::string& field, const std::string& value)

API filtering parameter: -not (Not Equal To)

Where the preceding column value does not equal the value specified.

Name Type Description
field const std::string& Filtered column.
value const std::string& Filter value.

Contents

Clone this wiki locally