Documentation ¶
Index ¶
- Constants
- Variables
- func DurationVar(name string) time.Duration
- func DurationVarDefault(name string, v interface{}) time.Duration
- func Int64Var(name string) int64
- func Int64VarDefault(name string, v int64) int64
- func IntVar(name string) int
- func IntVarDefault(name string, v int) int
- func Set(name string, value interface{})
- func Sets(vars map[string]interface{})
- func StringVar(name string) string
- func StringVarDefault(name string, v string) string
- func Var(name string) interface{}
- func VarValue[T any](name string, t T) T
- type CORS
- type CORSWhitelist
Constants ¶
View Source
const ( ERROR_BASE_PATH = 10011 ErrorBasePath = "无法获取根路径" )
Variables ¶
View Source
var ( BasePath string // 定义项目的根目录 Debug bool = false Swagger bool = true EnableRegister bool = false EventDestroyPrefix = "Destroy_" // 程序退出时需要销毁的事件前缀 ConfigKeyPrefix = "Config_" // 配置文件键值缓存时,键的前缀 DateFormat = "2006-01-02 15:04:05" // 配置文件键值缓存时,键的前缀 //gorm 数据库客户端,如果您操作数据库使用的是gorm,请取消以下注释,在 bootstrap>init 文件,进行初始化即可使用 DB *gorm.DB // 全局gorm的客户端连接 //gin engine Engine *gin.Engine //websocket WebsocketHub interface{} //casbin 全局操作指针 Enforcer *casbin.SyncedEnforcer // CORS Cors *CORS = &CORS{ Mode: "allow-all", } )
Functions ¶
func DurationVar ¶
func DurationVarDefault ¶
func Int64VarDefault ¶
func IntVarDefault ¶
func StringVarDefault ¶
Types ¶
type CORS ¶
type CORS struct { Mode string `mapstructure:"mode" json:"mode" yaml:"mode"` Whitelist []CORSWhitelist `mapstructure:"whitelist" json:"whitelist" yaml:"whitelist"` }
type CORSWhitelist ¶
type CORSWhitelist struct { AllowOrigin string `mapstructure:"allow-origin" json:"allow-origin" yaml:"allow-origin"` AllowMethods string `mapstructure:"allow-methods" json:"allow-methods" yaml:"allow-methods"` AllowHeaders string `mapstructure:"allow-headers" json:"allow-headers" yaml:"allow-headers"` ExposeHeaders string `mapstructure:"expose-headers" json:"expose-headers" yaml:"expose-headers"` AllowCredentials bool `mapstructure:"allow-credentials" json:"allow-credentials" yaml:"allow-credentials"` }
Click to show internal directories.
Click to hide internal directories.