You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* ignore unexported fields that are not embedded structs
* fix#74 [BREAKING CHANGE] Select#GroupBy and Select#OrderBy behavior change.
Previous, GroupBy and OrderBy only keep the columns in the last call. Now, all columns are kept.
* fix#75 add Struct#Columns/ColumnsForTag and Struct#Values/ValuesForTag
* remove a call to StructField.IsExported as it is not in go1.13
* refs #78 add new `fieldas` tag to set AS name for SELECT
* update docs
* fix#81 refactory struct field parser to make fieldas correct in all cases
* Add Gitter badge
* Fix insert ignore for postgres and sqlite.
* fix test
Co-authored-by: Michał Dobaczewski <[email protected]>
Co-authored-by: Huan Du <[email protected]>
Co-authored-by: The Gitter Badger <[email protected]>
Co-authored-by: Zhong Ren <[email protected]>
[](https://coveralls.io/github/huandu/go-sqlbuilder?branch=master)[](https://gitter.im/go-sqlbuilder/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
7
8
8
-[Install](#install)
9
9
-[Usage](#usage)
@@ -134,8 +134,9 @@ We can define a struct type and use field tags to let `Struct` know how to creat
134
134
typeATablestruct {
135
135
Field1string// If a field doesn't has a tag, use "Field1" as column name in SQL.
136
136
Field2int`db:"field2"`// Use "db" in field tag to set column name used in SQL.
137
-
Field3int64`db:"field3" fieldtag:"foo,bar"`// Set fieldtag to a field. We can use methods like `Struct#SelectForTag` to use it.
138
-
Field4int64`db:"field4" fieldtag:"foo"`// If we use `s.SelectForTag(table, "foo")`, columnes of SELECT are field3 and field4.
137
+
Field3int64`db:"field3" fieldtag:"foo,bar"`// Set fieldtag to a field. We can call `WithTag` to change default tag or call methods like `Struct#SelectForTag` to set tag explicitly.
138
+
Field4int64`db:"field4" fieldtag:"foo"`// If we use `s.WithTag("foo").Select(table)`, columnes of SELECT are field3 and field4.
139
+
Field5string`db:"field5" fieldas:"f5_alias"`// Use "fieldas" in field tag to set a column alias (AS) used in SELECT.
139
140
Ignoredint32`db:"-"`// If we set field name as "-", Struct will ignore it.
140
141
unexported int// Unexported field is not visible to Struct.
141
142
Quotedstring`db:"quoted" fieldopt:"withquote"`// Add quote to the field using back quote or double quote. See `Flavor#Quote`.
0 commit comments