@@ -21,7 +21,7 @@ Frontend should send the parameters and operator like this schema to the backend
2121 },
2222 { "name" : " title" , "operator" : " like" , "value" : " xyz" }
2323 ],
24- "group_by" : [" billing_plan_name " ],
24+ "group_by" : [" plan_name " ],
2525 "offset" : 20 ,
2626 "limit" : 50 ,
2727 "search" : " abcd" ,
@@ -38,12 +38,12 @@ The validation happens via stuct tags defined on your model. Example:
3838
3939``` golang
4040type Organization struct {
41- Id int ` rql:"type=number,min=10,max=200"`
42- BillingPlanName string ` rql:"type=string"`
43- CreatedAt time.Time ` rql:"type=datetime"`
44- MemberCount int ` rql:"type=number"`
45- Title string ` rql:"type=string"`
46- Enabled bool ` rql:"type=bool"`
41+ Id int ` rql:"name=id, type=number,min=10,max=200"`
42+ BillingPlanName string ` rql:"name=plan_name, type=string"`
43+ CreatedAt time.Time ` rql:"name=created_at, type=datetime"`
44+ MemberCount int ` rql:"name=member_count, type=number"`
45+ Title string ` rql:"name=title, type=string"`
46+ Enabled bool ` rql:"name=enabled, type=bool"`
4747}
4848
4949```
@@ -102,9 +102,9 @@ Using this struct, a SQL query can be generated. Here is an example using `goqu`
102102 for _ , sort_item := range userInput.Sort {
103103 switch sort_item.Order {
104104 case " asc" :
105- query = query.OrderAppend (goqu.C (sort_item.Key ).Asc ())
105+ query = query.OrderAppend (goqu.C (sort_item.Name ).Asc ())
106106 case " desc" :
107- query = query.OrderAppend (goqu.C (sort_item.Key ).Desc ())
107+ query = query.OrderAppend (goqu.C (sort_item.Name ).Desc ())
108108 default :
109109 }
110110 }
0 commit comments