Skip to content

Commit 8fa20c7

Browse files
committed
refs #60. more flexibility to filter fields with WithTag and WithoutTag in Struct
1 parent 1191d33 commit 8fa20c7

File tree

5 files changed

+438
-86
lines changed

5 files changed

+438
-86
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ debug_test
3333

3434
# Mac
3535
.DS_Store
36+
37+
# go work
38+
go.work
39+
go.work.sum

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ We can define a struct type and use field tags to let `Struct` know how to creat
136136
type ATable struct {
137137
Field1 string // If a field doesn't has a tag, use "Field1" as column name in SQL.
138138
Field2 int `db:"field2"` // Use "db" in field tag to set column name used in SQL.
139-
Field3 int64 `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.
139+
Field3 int64 `db:"field3" fieldtag:"foo,bar"` // Set fieldtag to a field. We can call `WithTag` to include fields with tag or `WithoutTag` to exclude fields with tag.
140140
Field4 int64 `db:"field4" fieldtag:"foo"` // If we use `s.WithTag("foo").Select(table)`, columnes of SELECT are field3 and field4.
141141
Field5 string `db:"field5" fieldas:"f5_alias"` // Use "fieldas" in field tag to set a column alias (AS) used in SELECT.
142142
Ignored int32 `db:"-"` // If we set field name as "-", Struct will ignore it.

0 commit comments

Comments
 (0)