Skip to content

Commit

Permalink
improved
Browse files Browse the repository at this point in the history
Signed-off-by: 商讯在线 <[email protected]>
  • Loading branch information
admpub committed Aug 23, 2014
1 parent 468f8d6 commit 560f3ef
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func main(){
t := reflect.TypeOf(m)
for i := 0; i < t.NumField(); i++ {
widget:=tagfast.Tag(m,i,"form_widget")
widget:=tagfast.Tag(t,i,"form_widget")
fmt.Println("widget:",widget)
valid:=tagfast.Tag(m,i,"valid")
valid:=tagfast.Tag(t,i,"valid")
fmt.Println("valid:",valid)
xorm:=tagfast.Tag(m,i,"xorm")
xorm:=tagfast.Tag(t,i,"xorm")
fmt.Println("xorm:",xorm)
}
Expand Down
5 changes: 2 additions & 3 deletions tagfast.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ func GetTag(struct_name string, field_name string) (r TagFast, ok bool) {
return
}

//usage: Tag(m,i,"form")
func Tag(i_struct interface{}, field_no int, key string) (tag string) {
t := reflect.TypeOf(i_struct)
//usage: Tag(t, i, "form")
func Tag(t reflect.Type, field_no int, key string) (tag string) {
if t.Field(field_no).Tag == "" {
return ""
}
Expand Down

0 comments on commit 560f3ef

Please sign in to comment.