OData (Open Data Protocol) is a standardized protocol developed by Microsoft for querying and updating data. It allows for the creation and consumption of queryable and interoperable RESTful APIs in a simple and standard way. OData helps applications expose data in a standard format, making it easier to interact with various data sources over HTTP.
Write OData queries in a semantic and easy-to-understand way, without typos.
- Semantic
- Typesafe
- Secure
const query = new Query().eq("name", "Test").and().eq("age", 1).build();
/* output
name eq 'Test' and age eq 1
*/
const query = new Query().eq("name", "Test").or().eq("age", 1).build();
/* output
name eq 'Test' or age eq 1
*/
const query = new Query().contains("name", "Test").build();
/* output
contains(name, 'Test')
*/
const query = new Query().eq("age", 1).build();
/* output
age eq 1
*/
const query = new Query().eq("name", "Whyy").build();
/* output
name eq 'Whyy'
*/
const query = new Query().ge("name", "Test").build();
/* output
age ge 'Test'
*/
const query = new Query().ge("age", 10).build();
/* output
age ge 10
*/
const query = new Query().ge("createdAt", new Date()).build();
/* output
createdAt ge '2022-01-01T00:00:00.000Z'
*/
npm i @icarowhyy/pnpjs-query
We welcome contributions! To contribute to the project, get in touch.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have any questions, please open an issue on our GitHub repository.