GithubHelp home page GithubHelp logo

alicevik22 / rql Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dvaldivia/rql

0.0 0.0 0.0 23 KB

A rest filter parser for Go that returns built queries

License: Apache License 2.0

Go 100.00%

rql's Introduction

RQL

REST Query Language

A library to introduce filters that can be passed by the client to the server via a query parameter using SQL like WHERE statements and getting a goqu []goqu.Expression in return.

Why?

Often applications building REST APIs need to expire a generic way to filter on top of existing resources, allowing the flexibility to filter by any field in the table, however coming up with a whole new syntax for such use case is complicated, on top of that you need to build the proper WHERE statement for a SQL query that is safe, RQL Filter addresses this.

RQL provides a way to safely and easily parse a filter statement and build a []goqu.Expression expression.

Examples

A query passed via GET or POST such as

field1='value1' AND (field2='value2' AND field3='value3')

woul yield the following expressions

[]goqu.Expression{
    goqu.C("field1").Eq("value1"),
    goqu.And([]goqu.Expression{
        goqu.C("field2").Eq("value2"),
        goqu.C("field3").Eq("value3"),
    }...),
}

TODOs

  • Pass list of valid fields to parser
  • Support dot-walking to related tables

rql's People

Contributors

dvaldivia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.