From 826d6b143cc194d6de0cc2d11138647c7261da2c Mon Sep 17 00:00:00 2001 From: Doug Martin Date: Fri, 29 May 2015 11:09:34 -0400 Subject: [PATCH] v2.0.3 * Fixed issue with transient columns and the auto select of columns. --- HISTORY.md | 4 ++++ dataset_select_test.go | 2 ++ expressions.go | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 9a7250ac..a3fe2276 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,7 @@ +## v2.0.3 + +* Fixed issue with transient columns and the auto select of columns. + ## v2.0.2 * Changed references to "github.com/doug-martin/goqu" to "gopkg.in/doug-martin/goqu.v2" diff --git a/dataset_select_test.go b/dataset_select_test.go index 4754ea43..fbf6e802 100644 --- a/dataset_select_test.go +++ b/dataset_select_test.go @@ -60,6 +60,7 @@ func (me *datasetTest) TestSelect() { Name string Address string `db:"address"` EmailAddress string `db:"email_address"` + FakeCol string `db:"-"` } sql, _, err = ds1.Select(&myStruct{}).ToSql() assert.NoError(t, err) @@ -125,6 +126,7 @@ func (me *datasetTest) TestSelectDistinct() { Name string Address string `db:"address"` EmailAddress string `db:"email_address"` + FakeCol string `db:"-"` } sql, _, err = ds1.SelectDistinct(&myStruct{}).ToSql() assert.NoError(t, err) diff --git a/expressions.go b/expressions.go index d6865b14..a0439511 100644 --- a/expressions.go +++ b/expressions.go @@ -236,8 +236,10 @@ func cols(vals ...interface{}) ColumnList { panic(err.Error()) } var structCols []string - for key, _ := range cm { - structCols = append(structCols, key) + for key, col := range cm { + if !col.Transient { + structCols = append(structCols, key) + } } sort.Strings(structCols) for _, col := range structCols {