From 560f3ef736d444fc267c1fe97349f84d4d687def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=95=86=E8=AE=AF=E5=9C=A8=E7=BA=BF?= Date: Sat, 23 Aug 2014 10:24:34 +0800 Subject: [PATCH] improved MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 商讯在线 --- README.md | 6 +++--- tagfast.go | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d1577a8..18d68c2 100644 --- a/README.md +++ b/README.md @@ -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) } diff --git a/tagfast.go b/tagfast.go index 63994e3..e02ec1c 100644 --- a/tagfast.go +++ b/tagfast.go @@ -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 "" }