From 12b1d5fd3064d54bc16b4d26e93e4a12c0e9e69a Mon Sep 17 00:00:00 2001 From: Remy DeWolf Date: Fri, 20 May 2022 17:10:07 -0700 Subject: [PATCH] Fix example for gorm without this fix, when using a filter using more than one column gorm would try to use the `FilterArgs` only on the first row. gorm api reference: https://github.com/go-gorm/gorm/blob/373bcf7aca01ef76c8ba5c3bc1ff191b020afc7b/chainable_api.go#L155 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8bee849..a54c188 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ func GetUsers(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusBadRequest) return } - err = db.Where(p.FilterExp, p.FilterArgs). + err = db.Where(p.FilterExp, p.FilterArgs...). Offset(p.Offset). Limit(p.Limit). Order(p.Sort). @@ -278,7 +278,7 @@ users, err = client.User.Query(). must(err, "failed to query ent") // gorm -err = db.Where(p.FilterExp, p.FilterArgs). +err = db.Where(p.FilterExp, p.FilterArgs...). Offset(p.Offset). Limit(p.Limit). Order(p.Sort).