url parameter parser for rest filter inquiry
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples rewrites map to do_parse, parsing functions, rearranging alt tags for… Jan 11, 2017
src clean up warnings Mar 8, 2017
tests Fix equation nom Mar 8, 2017
unused
.gitignore used rustfmt Sep 1, 2016
.travis.yml
Cargo.lock clean up warnings Mar 8, 2017
Cargo.toml clean up warnings Mar 8, 2017
LICENSE Added MIT license Nov 8, 2015
README.md touching to rebuild on latest nightlies Jan 6, 2016
appveyor.yml add more badges Nov 8, 2015
update-docs.sh

README.md

Inquerest

Latest Version Build Status Coverage Status MIT licensed Build status

A complex url parameter parser for rest filter queries

Example

age=lt.13&(student=eq.true|gender=eq.M)&group_by=sum(age),grade,gender&having=min(age)=gt.13&order_by=age.desc,height.asc&page=20&page_size=100&x=123&y=456

Will resolve into

Query {
        filters: [
            Filter {
                connector: None,
                condition: Condition {
                    left: Column("age"),
                    equality: LT,
                    right: Number(13)
                },
                subfilter: [
                    Filter {
                        connector: Some(AND),
                        condition: Condition {
                            left: Column("student"),
                            equality: EQ,
                            right: Boolean(true)
                        },
                        subfilter: [
                            Filter {
                                connector: Some(OR),
                                condition: Condition {
                                    left: Column("gender"),
                                    equality: EQ,
                                    right: Column("M")
                                },
                            }
                        ]
                    }
                ]
            }
        ],
        group_by: [
            Function(
                Function {
                    function: "sum",
                    params: [Column("age")]
                }
            ),
            Column("grade"),
            Column("gender")
        ],
        having: [
            Filter {
                connector: None,
                condition: Condition {
                    left: Function(
                        Function {
                            function: "min",
                            params: [Column("age")]
                        }
                    ),
                    equality: GT,
                    right: Number(13)
                },
            }
        ],
        order_by: [
            Order {
                column: "age",
                direction: DESC
            },
            Order {
                column: "height",
                direction: ASC
            }
        ],
        range: Some(Page( 
			Page{ page: 20, page_size:100 } 
		)),
        equations: [
            Equation {
                left: Column("x"),
                right: Number(123)
            },
            Equation {
                left: Column("y"),
                right: Number(456)
            }
        ]
    }

More examples in

Inspired by Postgrest Filter expressions

##Similar projects

If you like this library, please consider supporting the project on Gratipay.