Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingZhang committed Aug 8, 2020
1 parent da0f8fe commit 4d0b345
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions interface/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ type UserInterface interface {
}

type User struct {
Name string `json:"name" form:"username"`
Age int `json:"age" form:"age"`
Name string `json:"name"`
Age int `json:"age"`
}

func (p User) Get(prop string) reflect.Value {
Expand All @@ -35,6 +35,6 @@ func main() {
}
fmt.Println(user.Get("Name"))
fmt.Println(user.Set("Name", "name_updated"))
fmt.Println(user.Get("Name"))
fmt.Printf("%v, %T\n", user.Get("Name").String(), user.Get("Name").String())
fmt.Println(user)
}
6 changes: 3 additions & 3 deletions struct/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
)

type User struct {
Name string `json:"name" form:"username"`
Age int `json:"age" form:"age"`
Name string `json:"name"`
Age int `json:"age"`
}

func (p User) Get(prop string) reflect.Value {
Expand All @@ -30,6 +30,6 @@ func main() {
}
fmt.Println(user.Get("Name"))
fmt.Println(user.Set("Name", "zfx_updated"))
fmt.Println(user.Get("Name"))
fmt.Printf("%v, %T\n", user.Get("Name").String(), user.Get("Name").String())
fmt.Println(user)
}
2 changes: 1 addition & 1 deletion struct/pointer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ func main() {
}
fmt.Println(user.Get("Name"))
fmt.Println(user.Set("Name", "zfx_updated"))
fmt.Println(user.Get("Name"))
fmt.Printf("%v, %T\n", user.Get("Name").String(), user.Get("Name").String())
fmt.Println(user)
}

0 comments on commit 4d0b345

Please sign in to comment.