Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

黄成意 / go_sku_server

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Find file
BlameHistoryPermalink
Switch branch/tag
  • go_sku_server
  • doc
  • test3
  • struct_ref.go
  • wang's avatar
    解决冲突 · ad60817b
    wang committed 4 years ago
    ad60817b
struct_ref.go 437 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
package main

import (
	"fmt"
	"github.com/gogf/gf/util/gconv"
	"reflect"
)

type abc struct {
	GoodsId  string `json:"goods_id" form:"goods_id" binding:"required" required_errcode:"10086" `
	Num  string `json:"num" form:"num" binding:"required"`
}

func main()  {
	abc:=abc{}
	typeof:=reflect.TypeOf(abc)

	filed,_:=typeof.FieldByName("GoodsId")
	s:=filed.Tag.Get("required_errcode")
	gconv.Int(s)
	si:=int(int64(s))
	fmt.Print(s,si)
}