diff --git a/boil/query_builders.go b/boil/query_builders.go index a3e646a..410baf6 100644 --- a/boil/query_builders.go +++ b/boil/query_builders.go @@ -32,7 +32,12 @@ func buildQuery(q *Query) (string, []interface{}) { defer strmangle.PutBuffer(buf) - return buf.String(), args + // Cache the generated query for query object re-use + bufStr := buf.String() + q.plainSQL.sql = bufStr + q.plainSQL.args = args + + return bufStr, args } func buildSelectQuery(q *Query) (*bytes.Buffer, []interface{}) {