// Aggregate functions
func Count() NumberField
func Sum(field interface{}) NumberField
func Avg(field interface{}) NumberField
func Min(field interface{}) NumberField
func Max(field interface{}) NumberField
Notice that instead of taking in a Field, the above aggregate functions take in an interface{}
.
This is to allow you also pass subqueries into it.
The same rendering logic for Fieldf and Predicatef apply here: you can pass anything into it, it is up to you to preserve the SQL semantics of your query.
If you need to use any other aggregate functions (e.g. array_agg
or json_agg
) you will need to use Fieldf/Predicatef.