package main

import (
"fmt"
"reflect"
)

type Test struct {
Id int `json:"user_id"`
Name string "this is name"
}

func main() {
t := Test{Id: 1, Name: "xiaochuan"}
r := reflect.TypeOf(t)

fmt.Println()
fmt.Printf("Id Tag is %s \n", r.Field(0).Tag)
fmt.Println()
fmt.Printf("Name Tag is %s \n", r.Field(1).Tag)
}

 

相关文章:

  • 2022-12-23
  • 2021-06-30
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2021-10-14
相关资源
相似解决方案