Skip to content

This library is intended to make it easier to write OData queries.

License

Notifications You must be signed in to change notification settings

IcaroSilvaFK/-whyy-pnpjs-query

Repository files navigation


This library is intended to make it easier to write OData queries.

Overview

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.

Features

  • Semantic
  • Typesafe
  • Secure

Basic Usage

AND
const query = new Query().eq("name", "Test").and().eq("age", 1).build();

/* output
 name eq 'Test' and age eq 1
*/
OR
const query = new Query().eq("name", "Test").or().eq("age", 1).build();
/* output
 name eq 'Test' or age eq 1
*/
CONTAINS
const query = new Query().contains("name", "Test").build();
/* output
 contains(name, 'Test')
*/
EQ
const query = new Query().eq("age", 1).build();
/* output
 age eq 1
*/

const query = new Query().eq("name", "Whyy").build();
/* output
  name eq 'Whyy'
*/
GE
const query = new Query().ge("name", "Test").build();
/* output
 age ge 'Test'
*/

const query = new Query().ge("age", 10).build();
/* output
  age ge 10
*/
Date example
const query = new Query().ge("createdAt", new Date()).build();

/* output
createdAt ge '2022-01-01T00:00:00.000Z'
*/

Install

npm i @icarowhyy/pnpjs-query

Contributing

We welcome contributions! To contribute to the project, get in touch.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

If you encounter any issues or have any questions, please open an issue on our GitHub repository.

About

This library is intended to make it easier to write OData queries.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published