Skip to content

Commit 60a70e2

Browse files
committed
fix #81 refactory struct field parser to make fieldas correct in all cases
1 parent a283436 commit 60a70e2

File tree

4 files changed

+329
-224
lines changed

4 files changed

+329
-224
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ We can define a struct type and use field tags to let `Struct` know how to creat
134134
type ATable struct {
135135
Field1 string // If a field doesn't has a tag, use "Field1" as column name in SQL.
136136
Field2 int `db:"field2"` // Use "db" in field tag to set column name used in SQL.
137-
Field3 int64 `db:"field3" fieldtag:"foo,bar"` // Set fieldtag to a field. We can use methods like `Struct#SelectForTag` to use it.
138-
Field4 int64 `db:"field4" fieldtag:"foo"` // If we use `s.SelectForTag(table, "foo")`, columnes of SELECT are field3 and field4.
137+
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.
138+
Field4 int64 `db:"field4" fieldtag:"foo"` // If we use `s.WithTag("foo").Select(table)`, columnes of SELECT are field3 and field4.
139139
Field5 string `db:"field5" fieldas:"f5_alias"` // Use "fieldas" in field tag to set a column alias (AS) used in SELECT.
140140
Ignored int32 `db:"-"` // If we set field name as "-", Struct will ignore it.
141141
unexported int // Unexported field is not visible to Struct.

0 commit comments

Comments
 (0)