inquerest 0.2.0

A complex url parameter parser for rest filter queries

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.