From 2ecff95e42cd6c846e29f27180cd06e026a1c935 Mon Sep 17 00:00:00 2001 From: Patrick O'brien Date: Thu, 1 Sep 2016 11:28:35 +1000 Subject: [PATCH] Add SQL string cache --- boil/query_builders.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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{}) {