go-queryset
go-queryset copied to clipboard
Support aggregations and selecting only some fields
Now we write:
db := ctx.GetGorm().
Select("max("+PointDBSchema.TripPointID.String()+") as max_id, "+
"count("+PointDBSchema.PlaceID.String()+") as rating").
Where(PointDBSchema.LocationID.String()+" = ?", locationID).
Group(PointDBSchema.PlaceID.String()).
Order("rating DESC").
Limit(limit)