Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 537 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 537 Bytes

Installation

go get github.com/si3nloong/go-rsql
type QueryParams struct {
    Name   string  `rsql:"n,filter,sort,allow=eq|gt|gte"`
    Status string  `rsql:"status,filter"`
    PtrStr *string `rsql:"text,filter"`
    No     int     `rsql:"no,column=No2,filter"`
}

func main() {
    p := MustNew(i)

    params, err := p.ParseQuery(`filter=status=eq="111";no=gt=1991;text==null&sort=status,-no`)
    if err != nil {
        panic(err)
    }

    log.Println(params.Filters)
    log.Println(params.Sorts)
}