
Security News
High Salaries No Longer Enough to Attract Top Cybersecurity Talent
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
spring-filter-query-builder
Advanced tools
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
A User-Friendly JavaScript/TypeScript Query Builder for Spring Filter.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Elevate your development experience with our straightforward Query Builder designed for use alongside Spring Filter. This lightweight tool boasts simplicity by being dependency-free and compatible with TypeScript and JavaScript projects.
Install the package using NPM:
npm install spring-filter-query-builder
Import the required functions from spring-filter-query-builder
into your JavaScript/TypeScript file:
import { sfAnd, sfEqual, sfGt, sfIsNull, sfLike, sfNot, sfOr } from 'spring-filter-query-builder';
Here's an example of how to use the library:
const filter = sfAnd([sfEqual('status', 'active'), sfGt('createdAt', '1-1-2000')]);
console.log(filter.toString());
This will output the generated filter query.
Explore Further with Examples
For additional examples, feel free to visit our CodeSandbox demo page.
All classes have a toString method. So you can convert any Object of these classes to string easily.
The library exposes all methods that you will need to create a query:
sfAnd([ item, item, ... ])
- and's one or more expressionssfOr([ item, item ... ])
- or's one or more expressionssfNot(item)
- not's an expressionsfExists(item)
- exists expressionsfLike(selector, value)
- Like comparatorsfEqual(selector, value)
- Equal comparatorsfNotEqual(selector, value)
- Not equal comparatorsfGt(selector, value)
- Greater than comparatorsfGe(selector, value)
- Greater than or equal comparatorsfLt(selector, value)
- Less than comparatorsfLe(selector, value)
- Less than or equal comparatorsfIsNull(selector)
- Is null comparatorsfIsNotNull(selector)
- Is not null comparatorsfIsEmpty(selector)
- Is empty comparatorsfIsNotEmpty(selector)
- Is not empty comparatorsfIn(selector, [ value, value, ...])
- In comparatorsfNotIn(selector, [ value, value, ...])
- Not in comparatorsfAbsolute(selector)
- Absolute functionsfAverage(selector)
- Average functionsfCeiling(selector)
- Ceiling functionsfConcat(value, value, ...)
- Concat functionsfCount(selector)
- Count functionsfCountDistinct(selector)
- CountDistinct functionsfCurrentDate()
- CurrentDate functionsfCurrentTime()
- CurrentTime functionsfCurrentTimestamp()
- CurrentTimestamp functionsfMin(selector)
- Min functionsfMax(selector)
- Max functionsfSum(selector, selector, ...)
- Sum functionsfSize(selector)
- Size functionsfLength(selector)
- Length functionsfTrim(selector)
- Trim functionsfUpper(selector)
- Upper functionsfLower(selector)
- Lower functionsfCustomFunction(functionName, value, value, ...)
- Any other custom functionExtend any of our predefined abstract classes – Comparator, Function, and Operator – to effortlessly craft custom logic tailored to your needs.
For creating custom comparators, refer to test/custom-comparator.test.ts.
For custom functions, explore test/custom-function.test.ts.
For custom operators, explore test/custom-operator.test.ts.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)FAQs
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
The npm package spring-filter-query-builder receives a total of 386 weekly downloads. As such, spring-filter-query-builder popularity was classified as not popular.
We found that spring-filter-query-builder demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A survey of 500 cybersecurity pros reveals high pay isn't enough—lack of growth and flexibility is driving attrition and risking organizational security.
Product
Socket, the leader in open source security, is now available on Google Cloud Marketplace for simplified procurement and enhanced protection against supply chain attacks.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.