Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code int
Code 自定义INT型类型 通过stringer指令为Code添加了String方法实现 那么直接通过fmt.Println(c)时会调用输出String方法而不是c值本身
const ( CodeErr Code = iota + 1 // 错误 CodeMsg // 提示 CodePwdError // 密码错误 CodeAccError // 账户错误 CodeValidError // 参数错误 CodeToRedirect // 跳转至 CodeSuccess Code = 500 // 登录成功 CodeForbidden Code = 600 // 禁止操作 CodeNotAllow Code = 700 // 无操作权限 )
通过为自定义类型Code的值定义时给注释备注而指定该code对应的文案 int_x_gen.go 即为生成的go源码文件,可以看到里面实现了fmt.String接口
Click to show internal directories.
Click to hide internal directories.