Skip to content

Representational State Transfer + Structured Query Language(RSQL): Demo application using RSQL parser to filter records based on provided condition(s)

Notifications You must be signed in to change notification settings

hardikSinghBehl/RSQL-spring-boot

Repository files navigation

Representational State Transfer + Structured Query Language: RSQL

Demo application using RSQL parser to filter records based on provided condition(s)

A Single GET API is all that is needed to be exposed per Entity class.

Additional Datatypes added/supported

  • UUID
  • LocalDate
  • LocalDateTime
  • Enum
  • Boolean String (true, false) and Bit (1,0)
  • Nested Objects

Additional Operations added/supported

  • equalIgnoreCase (=eic=)
  • notEqualIgnoreCase (=neic=)

Sample Recording showing examples

RSQL-Sample-Examples.mov

Pagination and Sorting Support

  • Pagination

    • Query parameters to include
      • count : maximum elements to be returned in a page
      • page : starts with 1, if value provided is <=0, first page is returned and if value>totalPages, the last page is returned
    • Sample path
    http:localhost:8080/wizards?query=gender==female&count=5&page=1
    
    • Sample Response
      {
      "currentPage": 1,
      "totalPages": 2,
      "count": 5,
      "result": [
          {
              "id": 2,
              "fullName": "Hermione Granger",
              "species": "HUMAN",
              "gender": "FEMALE",
              "house": {
                  "id": 1,
                  "name": "Gryffindor"
              },
              "dateOfBirth": "1979-09-19",
              "eyeColor": "brown",
              "hairColor": "brown",
              "wand": {
                  "id": 2,
                  "wood": "vine",
                  "core": "dragon heartstring",
                  "length": null
              },
              "patronus": null,
              "isProfessor": false,
              "alive": true,
              "imageUrl": "http://hp-api.herokuapp.com/images/hermione.jpeg"
          } ... and 4 more
      ]
    }
    
  • Sorting

    • Query parameter to be included

      • sort
    • Operators

      • Ascending: @
      • Descending: $
    • Examples:

      • to sort with fullName descending
      &sort="$descending"
      
      • to sort with dateOfBirth ascending
      &sort="@dateOfBirth"
      
      • to sort with ascending dateOfBirth and fullname descending
      &sort="@dateOfBirth$fullname"
      

SQL Injection Attack Prevention Support

SQL-Injection-prevention-rsql.mov

Important Classes and packages

References


⭐️ Star the repository to show support

🤝 PRs welcome

About

Representational State Transfer + Structured Query Language(RSQL): Demo application using RSQL parser to filter records based on provided condition(s)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages